Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shenzhe/geohash
php geohash extension
https://github.com/shenzhe/geohash
Last synced: about 2 months ago
JSON representation
php geohash extension
- Host: GitHub
- URL: https://github.com/shenzhe/geohash
- Owner: shenzhe
- License: mit
- Created: 2014-02-12T10:04:54.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-04-19T04:34:46.000Z (over 6 years ago)
- Last Synced: 2024-08-03T20:07:33.288Z (5 months ago)
- Language: C
- Size: 17.6 KB
- Stars: 149
- Watchers: 12
- Forks: 53
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-php-extensions - geohash - geohash (地理)
README
geohash
=======php geohash extension (php geohash 扩展)
编译
======git clone 到机器
执行:
phpize
./configure
make
make install然后把 geohash.so 加入到php.ini中
方法
====/**
* $latitude //纬度
* $longitude //经度
* $precision //精密度, 默认是12
* 返回 $precision 长度的 string
*/
geohash_encode($latitude, $longitude, $precision=12);/**
* $hash //geohash_encode后的值
* 返回 array // Array
* (
* [latitude] => 39.416916975752
* [longitude] => 100.92223992571
* [north] => 39.416917059571
* [east] => 100.92224009335
* [south] => 100.92223992571
* [west] => 100.92223975807
* )
*/
geohash_decode($hash);/**
* $hash //geohash_encode后的值
* 返回 在$hash 8个方向的hash值 (顺序:N, NE, E, SE, S, SW, W, NW)
*
* NW N NE
* \|/
* W - - E
* /|\
* SW S SE
*
*/
geohash_neighbors($hash);/**
* $precision //精密度
* 返回 数组,array("width"=>12.0, "height"=>12.0)
* 表示矩形的宽和高
*/
geohash_dimension($precision);