boehm_s/php-proximity-hash

本包最新版本(v0.1.2)没有提供许可证信息。

Ashwin Nair 编写的 proximityhash 算法的 PHP 版本

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

This package is auto-updated.

Last update: 2024-09-06 23:32:19 UTC


README

PHP 版本的 https://github.com/ashwin711/proximityhash

Geohash 是由 Gustavo Niemeyer 发明的一个地理编码系统,并将其置于公有领域。它是一个分层空间数据结构,将空间细分为网格形状的桶,这是 Z-order 曲线众多应用之一,通常称为填充曲线。

要可视化 geohashes,您可以访问这里: http://geohash.gofreerange.com

ProximityHash 根据中心坐标和半径生成覆盖圆形区域的 geohashes 集合。

以下是地图上的示意图

ProximityHash illustration

致谢

https://github.com/ashwin711/proximityhash

安装

composer require boehm_s/php-proximity-hash

使用

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