ccinn/geohash
Composer 安装命令:
composer create-project ccinn/geohash
包简介
Class libraries implemented using PHP based on GeoHash algorithms.
README 文档
README
Class libraries implemented using PHP based on GeoHash algorithms.
For details, please refer to the blog (Chinese):
https://usblog.crazylaw.cn/index.php/archives/324/
Usage
Three API methods are provided.
-
around($lng, $lat, $interceptLength = 0)Convert the HashCode in the 9 regions of the longitude and latitude. -
encode($lng, $lat, $interceptLength = 0)Converts HashCode to the specified latitude and longitude. -
distance($centerLng, $centerLat, $pointLng, $pointLat, $lenType = 1, $decimal = 2)Calculate the distance between two latitude and longitude.
example:
require_once 'vendor/autoload.php'; // The base hashcode length must be a multiple of 5, otherwise it will automatically be filled to a multiple of 5. // The longer the base length of hashcode is, the more options are available to intercept, and the longer it is recommended. 10 is usually enough. $hashCodeLength = 10; $geohash = new ccinn\GeoHash($hashCodeLength); // Search nearby 20 meters $interceptLength = 8; $around = $geohash->around(113.314748, 23.125851, $interceptLength); var_dump($around, $point = $geohash->encode(113.314851, 23.125839, $interceptLength)); if (in_array($point, $around)) { echo 'in_around' . PHP_EOL; } else { echo 'not_in_around' . PHP_EOL; } var_dump('distance:' . $geohash->distance(113.314748, 23.125851, 113.314851, 23.125839) . 'm');
ccinn/geohash 适用场景与选型建议
ccinn/geohash 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ccinn/geohash 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ccinn/geohash 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-01-29