PHP code example of beste / latlon-geohash
1. Go to this page and download the library: Download beste/latlon-geohash library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
beste / latlon-geohash example snippets
use Beste\Geohash;
// encode latitude/longitude point to geohash of given precision (number of
// characters in resulting geohash); if precision is not specified, it is
// inferred from precision of latitude/longitude values.
Geohash::encode(float $lat, float $lon, ?int $precision = null)
// return { lat, lon } of centre of given geohash, to appropriate precision.
Geohash::decode(string $geohash)
// return { sw, ne } bounds of given geohash.
Geohash::bounds(string $geohash)
// return adjacent cell to given geohash in specified direction (n/s/e/w).
Geohash::adjacent(string $geohash, string $direction)
// return all 8 adjacent cells (n/ne/e/se/s/sw/w/nw) to given geohash.
Geohash::neighbours(string $geohash)