8

I am using google place api to search specific types like(gas_station,cafes,shopping_malls etc...) here is link i am using https://maps.googleapis.com/maps/api/place/search/json?location=41.104805,29.024291&radius=50000&types=gas_station&sensor=false&key=AIzaSyAhVKOOLN1lx6iKKnbXMT82W1cKG7O8cDY

so here i need to search all gas_stations nearby my location so here i get "

results" : [],
   "status" : "ZERO_RESULTS"

But in my location some gas_stations are there(i search google map) so how can i get these results can any one help me..

Thanks for advance.

Mike Jeffrey
  • 3,149
  • 1
  • 19
  • 18
Chithri Ajay
  • 907
  • 3
  • 16
  • 37

1 Answers1

14

The problem is with the categorization of the data. If you do a search for types=university you'll see a number of results. Now look at the types in those results - they're listed mostly as ["university", "establishment"].

All of the gas stations in the area are only categorized as ["establishment"], so they're not coming up in your search for gas_station.

You could use the keyword search to return businesses with "gas%20station" in their metadata. It seems to return the same results as searching for "gas station" around that area in Google Maps.

Mike Jeffrey
  • 3,149
  • 1
  • 19
  • 18
  • thanks for your response i tried type establishment also i get 20 locations but in this there is no gas_stations – Chithri Ajay Dec 29 '11 at 06:22
  • It seems that the gas stations aren't categorized beyond 'establishment'. I'd suggest not using the `type` parameter for this particular search, and just using `keyword=gas%20station`. That'll give you the same (or very similar) results as when you search for 'gas station' on Google Maps in the same area. – Mike Jeffrey Dec 29 '11 at 18:39
  • thanks mike...it's working so i need some more type like cafes, shopping_malls so can i write this keyword=gas%20station|cafes|shopping%20malls ?how can increment locations count i get only 20 can i increment this count? – Chithri Ajay Dec 30 '11 at 05:21
  • As far as I know, there's no way to do 'OR' searches like that with the `keyword` field. You could search for all of the terms, but they'd be returned as a group with no way to differentiate between each type. You're better to run multiple Place searches, if you need to keep track of categories. Re: getting more than 20 results, there's no documented `start` or `page` parameter that would suggest the ability to retrieve further results. – Mike Jeffrey Jan 04 '12 at 18:34
  • This google apis return the places in sets of 20, the maximum number of places that an api can fetch is 60. If you carefully observe the response of the google places api, it has a parameter called next_pagetoken. So the second time you hit the API u need to pass this next_pagetoken to fetch the next set of schools.@ChithriAjay – UserName_Untold Aug 02 '16 at 07:24