Search Places by category

1

I'm using api google places that returns a JSON, I was able to search for places with lat and long and also with placeid , now I need to search the place for tipo/categoria eg restaurant, gym, electronics and etc.

To search for lat / long I used this URL:

https://maps.googleapis.com/maps/api/place/search/json?location="+String.valueOf(lat)+","+String.valueOf(longt)+"&radius=100&sensor=true&key="+APKEY);

But I'm not able to search for categoria .

    
asked by anonymous 06.07.2015 / 22:42

1 answer

1

For searches on the Google Places WS API for a category, like you said, you must enter as a parameter, in addition to the required ( location , radius , key and radius ), the types attribute, according to documentation:

  

types - restricts results to places that match at least one of the specified types.

An example searching for gyms would be in this format:

https://maps.googleapis.com/maps/api/place/search/json?location=-27.6142358,-48.4828248&radius=1000&types=gym&key=<api_key>

If you need to search for more than one type, such as gyms and bars, just separate the types with a | , so it would look like this:

https://maps.googleapis.com/maps/api/place/search/json?location=-27.6142358,-48.4828248&radius=1000&types=gym|bar&key=<api_key>

For all types of locations, you can check this link: Types of locations

    
07.07.2015 / 00:04