boehm_s / php-proximity-hash
A PHP port of the proximityhash algorithm by Ashwin Nair
Installs: 2 200
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- saikiran/geohash: ^1.0
Requires (Dev)
- phpunit/phpunit: ^8
README
A port of https://github.com/ashwin711/proximityhash for PHP.
Geohash is a geocoding system invented by Gustavo Niemeyer and placed into the public domain. It is a hierarchical spatial data structure which subdivides space into buckets of grid shape, which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
To visualize geohashes, you can go here : http://geohash.gofreerange.com
ProximityHash generates a set of geohashes that cover a circular area, given the center coordinates and the radius.
Below is an illustration of what it looks like on a map :
Credits
https://github.com/ashwin711/proximityhash
Installation
composer require boehm_s/php-proximity-hash
Usage
use boehm_s\ProximityHash; $latitude = 48.858156; $longitude = 2.294776; $radius = 1000; // in meters $precision = 6; // number of characters in the geohashes generated $res = ProximityHash::generate($latitude, $longitude, $radius, $precision);