如何使用iphone中的谷歌API来查询我周围的酒店 [英] how use google api in iphone to query hotels around my place
问题描述
我是google apis和iphone LBS相关应用的新手。我需要知道如何使用google api并获取我的GPS位置附近的酒店列表。
这里通过javascript实现相同的功能。如何在iPhone应用程序上做到这一点?
http://code.google.com/apis/ajax/playground/#localsearch_with_markers
您是否尝试过 - http://code.google.com/apis/maps / documentation / places /#PlaceSearches ?
它看起来像一个普通的web服务,你可以发布一个请求,它应该给你一个XML / JSON列表在你周围的所有酒店。
从网站 -
请求= http://maps.google.com/maps/api/place/search/json?location=40.717859,-73.957790&radius=1600&client=clientId&sensor=true_or_false&signature=SIGNATURE
回应=
{
status: OK,
results:[{
name:Willia msburg,
types:[locality,political],
icon:http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71。 png,
reference:ClRBAAAAXP ... lHAPyHom2aG
},{
name:Greenpoint,
nearby:New York,
types:[neighborhood,political],
icon:http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png,
reference:CkQ_AAAAhd ... MF45fwr44Ek
},{
name:Peter Luger Steakhouse,
nearby:Broadway,Brooklyn,
types:[restaurant,food,establishment],
icon:http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71 bng,
reference:ClRCAAAAt3 ... 6Nt7k11iQdT
},{
name:威廉斯堡音乐厅,
Nearby:布鲁克林北6街,
类型:[建立],
图标:http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71。 png,
refe rence:ClRFAAAAN ... 6UOKCbjv7Sxy
},
...附加结果...
],
html_attributions:[]
}
I am new to google apis and iphone LBS related apps. I need to know how to use a google api and get the list of hotels around my GPS location.
Here the same functionality is achieved through javascript. how to do this on iphone application ?
http://code.google.com/apis/ajax/playground/#localsearch_with_markers
Did you try - http://code.google.com/apis/maps/documentation/places/#PlaceSearches ?
It looks like a normal webservice, you can just post a request and it should give you an XML / JSON list of all the hotels around you ..
From the website -
Request = http://maps.google.com/maps/api/place/search/json?location=40.717859,-73.957790&radius=1600&client=clientId&sensor=true_or_false&signature=SIGNATURE
Response =
{
"status": "OK",
"results": [ {
"name": "Williamsburg",
"types": [ "locality", "political" ],
"icon": "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"reference": "ClRBAAAAXP...lHAPyHom2aG"
}, {
"name": "Greenpoint",
"vicinity": "New York",
"types": [ "neighborhood", "political" ],
"icon": "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"reference": "CkQ_AAAAhd...MF45fwr44Ek"
}, {
"name": "Peter Luger Steakhouse",
"vicinity": "Broadway, Brooklyn",
"types": [ "restaurant", "food", "establishment" ],
"icon": "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"reference": "ClRCAAAAt3...6Nt7k11iQdT"
}, {
"name": "Music Hall of Williamsburg",
"vicinity": "North 6th Street, Brooklyn",
"types": [ "establishment" ],
"icon": "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"reference": "ClRFAAAAN...6UOKCbjv7Sxy"
},
...additional results ...
],
"html_attributions": [ ]
}
这篇关于如何使用iphone中的谷歌API来查询我周围的酒店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!