是否有一個谷歌地圖api,將允許您傳遞一個位置名稱,它會返回座標指向谷歌地圖上的位置?好的google.maps地理位置api?
3
A
回答
0
是的,需要使用反向地理位置。你可以發送一個地址或位置字符串,它會給你一個可能的緯度/經度座標數組。這些是GeocoderResults,通常第一個是你想要的。就像,如果你想在美國,你可以做
geocoder.geocode({'address': 'USA' }, function(results, status) {
response($.map(results, function(item) {
var latlng = new google.maps.LatLng(item.geometry.location.lat(), item.geometry.location.lng());
//Do some action with the provided latlng
}));
});
2
下面是一個例子請求:
http://maps.googleapis.com/maps/api/geocode/xml?address=Berlin&sensor=false
您可以篩選結果:爲geometry/location/lat
和lng
<GeocodeResponse>
<status>OK</status>
<result>
<type>locality</type>
<type>political</type>
<formatted_address>Berlin, Deutschland</formatted_address>
[…]
<geometry>
<location>
<lat>52.5234051</lat>
<lng>13.4113999</lng>
</location>
<location_type>APPROXIMATE</location_type>
<viewport>[…]</viewport>
<bounds>[…]</bounds>
</geometry>
</result>
</GeocodeResponse>
0
Mappy a同樣提供相同的免費服務。看看mappy.com並搜索其餘的api。
相關問題
- 1. 地理位置API
- 2. 良好的地理定位API由IP
- 3. 地理位置+ Google Maps API?
- 4. 地理位置API /服務
- 5. Google地理位置API庫
- 6. 鼓勵地理位置API
- 7. 地理位置API爲Rails
- 8. 使用谷歌地理定位API的地理位置
- 9. 商店定位器API +地理位置
- 10. Google地圖API - 存儲地理位置
- 11. 谷歌地圖API(地理位置)
- 12. 讓Django地理位置感知的好方法? - Django /地理位置
- 13. Google Maps Api HTML5地理位置與Android位置API
- 14. 谷歌地理位置API的問題
- 15. 實現Phonegap的地理位置API Android
- 16. IP地理位置的PHP和API
- 17. 如何使用Facebook圖表API獲取Facebook地理位置的地理位置
- 18. Google地理位置和方向API
- 19. youtube-api,v3,地理位置信息
- 20. 在SoundCloud API中搜索地理位置?
- 21. W3C地理位置API在Chrome
- 22. WIPmania API - 獲取IP地理位置
- 23. 地理位置api與方向箭頭
- 24. Google Maps JavaScript API地理位置標記
- 25. 谷歌IP地理位置API
- 26. 谷歌關閉地理位置api
- 27. Firefox地理位置API替代
- 28. JavaScript:沒有通過地理位置API獲取位置
- 29. 如何使「xx km」從位置,地理位置/谷歌api
- 30. 地理位置API - 等待獲得位置
我甚至都不知道Google Maps Data API不再可用:http://code.google.com/intl/nl/apis/maps/documentation/mapsdata/他們提供了另一種選擇。 – Harmen