2017 © Pedro Peláez
 

library geohash

geohash like python-geohash

image

lvht/geohash

geohash like python-geohash

  • Thursday, August 24, 2017
  • by lvht
  • Repository
  • 2 Watchers
  • 52 Stars
  • 31,822 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 21 Forks
  • 2 Open issues
  • 4 Versions
  • 27 % Grown

The README.md

GeoHash

Simple php geohash class like python-geohash., (*1)

Getting Started

Install

composer require lvht/geohash, (*2)

System Requirements

You need PHP >= 5.4.0., (*3)

Usage

Encode a coordinate:, (*4)

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

The result is wwe0x0euu12., (*5)

The default precision is 0.00001 which can be changed by the third parameter of encode method., (*6)

Find the neighbors for a given geohash:, (*7)

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

and the result is:, (*8)

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:, (*9)

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

and the result is:, (*10)

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
}

The Versions

24/08 2017

dev-master

9999999-dev http://github.com/lvht/geohash

geohash like python-geohash

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

geohash

24/08 2017

v1.1.0

1.1.0.0 http://github.com/lvht/geohash

geohash like python-geohash

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

geohash

29/07 2016

v1.0.0

1.0.0.0 http://github.com/lvht/geohash

geohash like python-geohash

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

geohash

11/09 2013

v0.1

0.1.0.0 http://github.com/jlyu/geohash

geohash like python-geohash

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

geohash