Search Locations by category

Asked

Viewed 97 times

1

I’m using the google Places api that returns a JSON, managed to search for sites by lat and long and also by placeid, now I need to search the site for tipo/categoria for example: restaurant, gym, electronics, etc.

To look for lat/long 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 can’t seem to get you by categoria.

1 answer

1


For searches on Google Places WS API by a category, as you said, you must inform as a parameter, in addition to the mandatory (location, radius, key and radius), the attribute types, as documented:

types - restricts the results to sites corresponding to at least one of the specified types.

An example searching for academies 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 look for more than one type, such as gyms and bars, just separate the guys with a |, then 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 sites, you can check this link: Types of venues

  • 1

    opa wonder was what I was looking for, vlw

Browser other questions tagged

You are not signed in. Login or sign up in order to post.