Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
607 views
in Technique[技术] by (71.8m points)

how use google api in iphone to query hotels around my place

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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": [ ]
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...