youthage / laravel-geohash
LBS地理位置距离计算方法geohash,将一个经纬度信息,转换成一个可以排序,可以比较的字符串编码,用于高效搜索
Installs: 18 125
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 1
Forks: 3
Open Issues: 0
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-05-04 17:48:09 UTC
README
Laravel GeoHash LBS地理位置距离计算方法geohash,将一个经纬度信息,转换成一个可以排序,可以比较的字符串编码,用于高效搜索
安装方法
composer require youthage/laravel-geohash
使用方法
<?php namespace App\Http\Controllers; use GeoHash; class IndexController extends Controller { public function index() { // 参数:纬度,经度,长度(可选,默认为最长) $geo = GeoHash::encode("69.3252", "136.2345", 9); echo $geo; list($lat, $lng) = GeoHash::decode($geo); echo $lat, ', ', $lng; } }