有没有一种方法可以使用Google Maps API返回经纬度坐标数组? [英] Is there a way to return an array of latitude and longitude coordinates using the google maps api?
问题描述
我想将地址数组传递给google maps api,然后作为回报接收经度和纬度点的数组.这可能吗?如果可以的话,我可以看到一个有关如何构造网址以处理数组的示例吗?
I want to pass an array of address to the google maps api, and then in return receive an array of longitude and latitude points. Is this possible? If so could I seen an example on how to construct the url to handle the array?
所以会是这样:
http://maps.googleapis.com/maps/api/geocode/xml?latlng=40.714224,-73.961452&sensor=false
但是我需要通过它address
而不是latlng
.
but i need to pass it address
rather than latlng
.
推荐答案
您需要地理编码器.在此处查看Google文档:
You want a geocoder. Check out the Google docs here:
http://code.google.com/apis/maps/documentation/javascript/reference.html#Geocoder
和此处的代码示例:
http://code.google.com/apis/maps/documentation/javascript/examples/geocoding-simple.html
您将要看一下上面示例中的codeAddress()
函数.它应该给您足够的入门知识:)
You'll want to look at the codeAddress()
function in the sample above. It should give you enough to get started :)
这篇关于有没有一种方法可以使用Google Maps API返回经纬度坐标数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!