2
我用下面的代碼使用下面的一段代碼來獲取特定的地方在地圖上的位置得到一個地方的經度和緯度針對其郵政編碼
NSString * urlString = [[NSString alloc] initWithFormat:@"http://maps.google.com/maps/geo?key=%@&output=xml&q=%@",GoogleMapsAPIKey,[placeName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
結果:
<?xml version="1.0" encoding="UTF-8" ?>
<kml xmlns="http://earth.google.com/kml/2.0"><Response>
<name>postdam</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>Potsdam, Germany</address>
<AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>DE</CountryNameCode><CountryName>Deutschland</CountryName><AdministrativeArea><AdministrativeAreaName>Brandenburg</AdministrativeAreaName><SubAdministrativeArea><SubAdministrativeAreaName>Potsdam</SubAdministrativeAreaName><Locality><LocalityName>Potsdam</LocalityName></Locality></SubAdministrativeArea></AdministrativeArea></Country></AddressDetails>
<ExtendedData>
<LatLonBox north="52.4513968" south="52.3424614" east="13.1866602" west="12.9305414" />
</ExtendedData>
<Point><coordinates>13.0586008,52.3969627,0</coordinates></Point>
</Placemark>
</Response></kml>
但現在我想獲取郵政編碼信息。如何使用maps.google.com做到這一點?
如果我給我的查詢字符串中的日文字符,可以嗎? – Satyam 2010-04-28 12:02:08
以及不完全是,我來自巴基斯坦和我的郵編是54600,我試圖用相同的URL - - 地理編碼 - <標ID =」 p1「> 54600 Villers-lès-Nancy,法國 - - FR CountryNameCode> 法國國家或地區名稱> - 洛林 ADMINISTRATIVEAREANAME> - Meurthe- et-Moselle SubAdministrativeAreaName> 等.....現在該怎麼辦? –
yunas
2010-04-28 13:21:00
200
此頁面詳細介紹瞭如何將搜索限制在特定區域:http://code.google.com/apis/maps/documentation/geocoding/index.html – 2010-04-28 14:27:27