boehm_s/php-proximity-hash

There is no license information available for the latest version (v0.1.2) of this package.

A PHP port of the proximityhash algorithm by Ashwin Nair

v0.1.2 2021-04-06 14:04 UTC

This package is auto-updated.

Last update: 2024-05-06 22:47:13 UTC


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 :

ProximityHash illustration

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);