Skizo-ozᴉʞS ツ
Skizo-ozᴉʞS ツ

Reputation: 20616

Google place API (Place searcher)

I've been using Google place API on old projects, but on those projects I had to pick a place and then, the API returned to me information about that place...

The thing is with this same API can I ask for a place for example Restaurant X, and then I get a json or xml with all of those Restaurant X (nearby or not)?

Or if it's another API to get places without having to pick them manually feel free to say it to me.

EDIT

I've found a tutorial but it's kinda old... but the thing is that I've implement all of those stuff and when I click on any item from the Spinner nothing changes...

And I think I'm calling correct the API

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=41.493375,2.354788333333333&radius=5000&types=restaurant&sensor=true&key=AIzaSyBXxZ6lF5WGqCi4ToRJoFihTxGOVzC5vGE

Upvotes: 2

Views: 136

Answers (1)

Sabarish Senthilnathan
Sabarish Senthilnathan

Reputation: 333

The Google Places API has a REST end-point that you could use to get back details of places of various types within the vicinity you provided.

For example, this end-point https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=44.661704,%20-63.609050&radius=2000&types=restaurant&name=thai&key=XXXX would return back all 'restaurants' that has a name 'thai' in it as a JSON.

The result would be something like this:

"html_attributions" : [],
   "results" : [
      {
         "geometry" : {
            "location" : {
               "lat" : 44.6496741,
               "lng" : -63.61783519999999
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "00b680706e7d8085d4b010b2d99789d8d046f9aa",
         "name" : "Thai Express",
         "opening_hours" : {
            "open_now" : true,
            "weekday_text" : []
         },
         "photos" : [
            {
               "height" : 517,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/104629276961555072183/photos\"\u003eThai Express\u003c/a\u003e"
               ],
               "photo_reference" : "CmRdAAAAJktMRG2eiCnmejhFOWMYxdpUq97IpUv407jlwfWGAPVVaksJsk36Cbv6ZONNfGs92kEA1Wtgw_4V_dCz5PhABknBl8eR-XIkloEQF2Cs9XmQbmQmV3lW5Q6hz4DYtPJwEhBuQUr3CwPP4dJmBnBfkLLmGhSB76vOFUm-NA_ab42xrdAPDhoq0A",
               "width" : 1562
            }
         ],
         "place_id" : "ChIJa6gRMpghWksRHseXPRkQT6c",
         "reference" : "CmRgAAAARuvIKASXzP7UxvFCd3dZ8TnIX58O2SHrtySdT09_HjwYFld8ktryg3mEvIyf-utJhnjPxJ74dV1Vk6slCTwdL3NOW4MYpDkyh3v1lCXYG1bdFw-QzchfeFC-KISlRkbWEhD_iDkV6G1ctXxnALq-rlyAGhTHCjz-C9bbQ9eE2NZeX34--ficrA",
         "scope" : "GOOGLE",
         "types" : [
            "meal_takeaway",
            "meal_delivery",
            "restaurant",
            "food",
            "point_of_interest",
            "establishment"
         ],
         "vicinity" : "7001 Mumford Road, Halifax"
      }
],
   "status" : "OK"
} 

More details about the Places API Web Service are here - https://developers.google.com/places/web-service/intro. The supported types you could search for are here - https://developers.google.com/places/supported_types.

Hope this answers your question.

Upvotes: 2

Related Questions