Google Maps API - 如何获取特定国家/地区的纬度和经度

时间:2010-10-15 14:37:41

标签: google-maps

是否有人知道如何使用Google Maps API从国家/地区名称获取纬度和经度?

1 个答案:

答案 0 :(得分:0)

似乎可以通过将国家/地区名称发送到地理编码器来获得大致指向国家中心的纬度/经度对。参见例如

的XML响应
http://maps.google.com/maps/geo?q=Spain&output=xml

回复是

 <kml xmlns="http://earth.google.com/kml/2.0"><Response> 
  <name>Spain</name> 
  <Status> 
    <code>200</code> 
    <request>geocode</request> 
  </Status> 
  <Placemark id="p1"> 
    <address>Spain</address> 
    <AddressDetails Accuracy="1" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>ES</CountryNameCode><CountryName>Espanya</CountryName></Country></AddressDetails> 
    <ExtendedData> 
      <LatLonBox north="45.2440000" south="35.1730000" east="5.0980000" west="-12.5240000" /> 
    </ExtendedData> 
    <Point><coordinates>-3.7492200,40.4636670,0</coordinates></Point> 
  </Placemark> 
</Response></kml>