GeocoderPHP 移动定位应用开发库
Geocoder 是 PHP 开发库,帮助你构建移动定位应用,提供一个强大的地理编码操作的抽象层。
<?php $geocoder = new \Geocoder\ProviderAggregator(); $geocoder->registerProviders([ new \Geocoder\Provider\GoogleMaps( $adapter, $locale, $region, $useSsl ), new \Geocoder\Provider\GoogleMapsBusiness( $adapter, '<CLIENT_ID>', '<PRIVATE_KEY>', $locale, $region, $useSsl ), new \Geocoder\Provider\Yandex( $adapter, $locale, $toponym ), new \Geocoder\Provider\MaxMind( $adapter, '<MAXMIND_API_KEY>', $service, $useSsl ), new \Geocoder\Provider\ArcGISOnline( $adapter, $sourceCountry, $useSsl ), ]); $geocoder->registerProvider( new \Geocoder\Provider\Nominatim( $adapter, 'http://your.nominatim.server', $locale ) ); $geocoder ->using('google_maps') ->geocode('...'); $geocoder ->limit(10) ->reverse($lat, $lng);
评论