好吧,看起來我再次找到答案。我在這裏找了一個多小時才找到這裏。但最終這裏是解決方案。我需要一個PHP解決方案,可以根據城市/州或郵政編碼獲取位置的邊界框座標。我發現這一點:
http://geocoder-php.org/Geocoder/
我創建的代碼能夠得到基於我指的是位置的邊框。
$curl = new \Ivory\HttpAdapter\CurlHttpAdapter();
$geocoder = new \Geocoder\Provider\GoogleMaps($curl);
$boundry = $geocoder->geocode('Danville, CA')->get(0)->getBounds()->toArray();
$north = $boundry['north'];
$south = $boundry['south'];
$east = $boundry['east'];
$west = $boundry['west'];
我安裝了這個通過作曲家和自動裝載這個類。這是我用來通過作曲家進行安裝:
composer require willdurand/geocoder
現在我可以動態生成邊界框座標附近的路段和工程就像一個魅力!希望這可以幫助其他人尋找一個簡單易用的PHP解決方案來從一個位置獲得邊界框,這個類還有很多其他的強大功能。
潛在地發現一些PHP工具,可以得到邊界框 – John
http://geocoder-php.org/Geocoder/,https://github.com/thephpleague/geotools,https://github.com/anthonymartin/ GeoLocation.php和http://stackoverflow.com/questions/2628039/php-library-calculate-a-bounding-box-for-a-given-lat-lng-location – John