如果有人來我的網上搜索找到紐約市的lat和lng,那麼如何通過使用google API獲取lat和lng,請幫助我如何爲此查詢編碼。如何使用google Api查找經度和緯度?
-3
A
回答
0
我想你在找Google Goocles Api。
你發送一個請求像這樣的東西: https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_API_KEY
再大的JSON對象回來,在那裏你可以得到lat和長
「的結果 - 幾何 - 位置 - 緯度/經度」
{
"results" : [
{
"geometry" : {
"location" : {
"lat" : 37.4224764,
"lng" : -122.0842499
},
...
...
看看這裏獲取更多一些信息https://developers.google.com/maps/documentation/geocoding/intro
0
第一次加載庫:
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?
key=YOUR_API_KEY&libraries=places">
</script>
然後找到具體位置的細節:
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -33.866, lng: 151.196},
zoom: 15
});
var infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
service.getDetails({
placeId: 'ChIJN1t_tDeuEmsRUsoyG83frY4'
}, function(place, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent('<div><strong>' + place.name + '</strong><br>' +
'Place ID: ' + place.place_id + '<br>' +
place.formatted_address + '</div>');
infowindow.open(map, this);
});
}
});
}
更換緯度和所需位置的經度。
更多細節請參考:
https://developers.google.com/maps/documentation/javascript/places#place_details
並且例如:
https://developers.google.com/maps/documentation/javascript/examples/place-details
相關問題
- 1. 查找經度和緯度
- 2. 如何查找緯度和經度
- 3. 使用API查找已知位置的經度和緯度?
- 4. 如何使用緯度和經度查找最近的商店?
- 5. 如何使用jVector地圖插件查找緯度和經度
- 6. 如何使用緯度和經度在iPhone中查找地址?
- 7. C# - 如何使用C#查找經度和緯度
- 8. 查找包含經度和緯度
- 9. 在經緯度和經度上使用Google Weather API - 如何格式化?
- 10. 如何找到經度和緯度
- 11. 從不使用Google API的地址獲取經度和緯度
- 12. 如何從google maps v3 api獲取經度和緯度?
- 13. 如何在google map api v2中獲取經度和緯度?
- 14. 如何通過Google Maps API檢索經度和緯度?
- 15. 如何獲取與Google地圖相同的Google Geocoder API幾何值(經度和緯度)URL經緯度值
- 16. 查詢REST API經緯度
- 17. 是否有Java API來查找位置的經度和緯度?
- 18. 如何查找GPS上的用戶的經度和緯度
- 19. 使用經度和緯度查找城市和州名稱
- 20. 如何從經度和緯度查找R和
- 21. 按經度和緯度查找商戶(API?/ Webservice?)
- 22. 如何使用Google Place API或任何JAVA API從URL獲取經度/緯度
- 23. Yelp API緯度經度
- 24. 如何在iphone4.0中查找經緯度?
- 25. 使用Android查找經度和緯度.Xamarin
- 26. 使用IP地址查找經度和緯度
- 27. 查找緯度/經度邊框
- 28. 在google map api中經緯度遞歸查找地址
- 29. 如何查找多個地址的經度和緯度
- 30. 如何查找我的Windows Phone 7.5的緯度和經度?