lvht/geohash 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lvht/geohash

最新稳定版本:v1.1.0

Composer 安装命令:

composer require lvht/geohash

包简介

geohash like python-geohash

关键字:

README 文档

README

Simple php geohash class like python-geohash.

Getting Started

Install

composer require lvht/geohash

System Requirements

You need PHP >= 5.4.0.

Usage

Encode a coordinate:

use Lvht\GeoHash;
echo GeoHash::encode(117.031689,36.65396);

The result is wwe0x0euu12.

The default precision is 0.00001 which can be changed by the third parameter of encode method.

Find the neighbors for a given geohash:

use Lvht\GeoHash;
var_dump(GeoHash::expand('wwe0x0'));

and the result is:

array(8) {
  [0] =>
  string(11) "wwe0wc7zzzz"
  [1] =>
  string(11) "wwe0x17zzzz"
  [2] =>
  string(11) "wwe0x37zzzz"
  [3] =>
  string(11) "wwe0wb7zzzz"
  [4] =>
  string(11) "wwe0x27zzzz"
  [5] =>
  string(11) "wwe0qz7zzzz"
  [6] =>
  string(11) "wwe0rp7zzzz"
  [7] =>
  string(11) "wwe0rr7zzzz"
}

Decode a geohash string:

Use Lvht\GeoHash;
var_dump(GeoHash::decode('wwe0x0'));

and the result is:

array(4) {
  [0] =>
  double(117.0263671875)    # min longitude
  [1] =>
  double(117.03735351562)   # max longitude
  [2] =>
  double(36.650390625)      # min latitude
  [3] =>
  double(36.655883789062)   # max latitude
}

统计信息

  • 总下载量: 562.32k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 77
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 76
  • Watchers: 3
  • Forks: 26
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-28