GithubHelp home page GithubHelp logo

geohash's Introduction

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值
 */
geohash_neighbors($hash);

/**
 *  $precision    //精密度
 *  返回 数组,array("width"=>12.0, "height"=>12.0) 
 *  表示矩形的宽和高
 */
geohash_dimension($hash);

geohash's People

Contributors

shenzhe avatar

Watchers

James Cloos avatar tianling avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.