如果有人来我的网上搜索找到纽约市的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的纬度和经度?