我正在使用 Google Place api 在 iphone 中显示位置。我正在使用 ClLocation 管理器类来获取将作为 api 参数传递的设备的当前位置。
但它并非每次在多个设备的不同位置都有效。
有什么帮助吗??
我正在使用 Google Place api 在 iphone 中显示位置。我正在使用 ClLocation 管理器类来获取将作为 api 参数传递的设备的当前位置。
但它并非每次在多个设备的不同位置都有效。
有什么帮助吗??
看一下这个
http://code.google.com/apis/maps/documentation/places/#PlaceSearches
您可以使用普通的 Web 服务,发布请求并获取 XML / JSON 列表
地点搜索请求是以下的 HTTP URL
https://maps.googleapis.com/maps/api/place/search/output?parameters
例如
获取 JSON 输出为
{
"html_attributions" : [
"Listings by \u003ca href=\"http://www.yellowpages.com.au/\"\u003eYellow Pages\u003c/a\u003e"
],
"results" : [
{
"geometry" : {
"location" : {
"lat" : -33.8719830,
"lng" : 151.1990860
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "677679492a58049a7eae079e0890897eb953d79b",
"name" : "Zaaffran Restaurant - BBQ and GRILL, Darling Harbour",
"rating" : 3.90,
"reference" : "CpQBjAAAAHDHuimUQATR6gfoWNmZlk5dKUKq_n46BpSzPQCjk1m9glTKkiAHH_Gs4xGttdOSj35WJJDAV90dAPnNnZK2OaxMgogdeHKQhIedh6UduFrW53wtwXigUfpAzsCgIzYNI0UQtCj38cr_DE56RH4Wi9d2bWbbIuRyDX6tx2Fmk2EQzO_lVJ-oq4ZY5uI6I75RnxIQJ6smWUVVIHup9Jvc517DKhoUidfNPyQZZIgGiXS_SwGQ1wg0gtc",
"types" : [ "restaurant", "food", "establishment" ],
"vicinity" : "Harbourside Centre 10 Darling Drive, Darling Harbour, Sydney"
},
{
"geometry" : {
"location" : {
"lat" : -33.8722580,
"lng" : 151.1986550
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "27ea39c8fed1c0437069066b8dccf958a2d06f19",
"name" : "Criniti's Darling Harbour",
"rating" : 3.60,
"reference" : "CnRwAAAA-5kh5WZ3m1CMTO3LslvhRtAYsrOcQP7wB9AE1bV5R6Bd46NN5wB16MtImXWQ9eS1nWVbV_j-8iXYXRpU13Efp1t_d-Dp4WfEsFcYj-_g6db1SC1vAukyeCyotjS5xrwhzqWWAhgmA4qIliWeev2u1BIQprWzxl_hkj_w3QdTiUBYKxoUDVTjF4RugJdaJWkC4n6w6pSajKw",
"types" : [ "restaurant", "food", "establishment" ],
"vicinity" : "Shop 461, 2-10 Darling Drive, Harbourside Shopping Centre, DARLING HARBOUR"
},
...additional results...
],
"status" : "OK"
}
像这样获取 XML
<?xml version="1.0" encoding="UTF-8"?>
<PlaceSearchResponse>
<status>OK</status>
<result>
<name>Zaaffran Restaurant - BBQ and GRILL, Darling Harbour</name>
<vicinity>Harbourside Centre 10 Darling Drive, Darling Harbour, Sydney</vicinity>
<type>restaurant</type>
<type>food</type>
<type>establishment</type>
<geometry>
<location>
<lat>-33.8719830</lat>
<lng>151.1990860</lng>
</location>
</geometry>
<rating>3.9</rating>
<icon>http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png</icon>
<reference>CpQBjAAAAJd_vFgeIo6ogU2gDLEe85XpxRi8LwIQXSVcPS5dxGIytvbNWic7gTlGIleeFRbrP-Rs4_V6AmCcF1RtaUXcb26_Oai6k6n34Ag17Cle3pnVl740CyNpp0VT48lOf7XkMngj75wKHqnApPZ9Bfcn0myuYeEZoKXw7c3pneO4Ty8FTxDqQyLiJk8CAkodTzSn5BIQj0ovOoMS5u-ds6_jygEGxRoUbKMNq2DBZdiS16jO3yku2DOBwNI</reference>
<id>677679492a58049a7eae079e0890897eb953d79b</id>
</result>
<result>
<name>Criniti's Darling Harbour</name>
<vicinity>Shop 461, 2-10 Darling Drive, Harbourside Shopping Centre, DARLING HARBOUR</vicinity>
<type>restaurant</type>
<type>food</type>
<type>establishment</type>
<geometry>
<location>
<lat>-33.8722580</lat>
<lng>151.1986550</lng>
</location>
</geometry>
<rating>3.6</rating>
<icon>http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png</icon>
<reference>CnRwAAAAwE_vlF04Iix2hijlKQsJLhpvAj8hwpfXGxtc0ckpBe0d54-rk4dxn8d1ZbaPGxxYfytkf4WJ7l5UC4Zh8jFZg0MTu1S8d66BK4vb2ktpAsKkfb28i3Mrf77ORRPXXjWwRtA7PEEfMP07mjfX3Xdg-RIQwjSMECQHM5S9WAohBIVB0BoUAb4i1DW-fL9E6XbgiDnmyZKrzRE</reference>
<id>27ea39c8fed1c0437069066b8dccf958a2d06f19</id>
</result>
...additional results...
<html_attribution>Listings by <a href="http://www.yellowpages.com.au/">Yellow Pages</a></html_attribution>
</PlaceSearchResponse>