Jeffrey J
Jeffrey J

Reputation: 53

Google Maps API Places Service (types)

I have looked at google's preset list of place types. I found one for 'establishment' as I want to populate markers for popular places to visit in a city for example. The problem is 'hospital' is also displayed under that category which I want to remove. Is there any way to accomplish this, or is there another free tourist attractions API that works with google maps?

Upvotes: 1

Views: 1361

Answers (1)

George Rappel
George Rappel

Reputation: 7188

A single place can have one or many types. So you have to get a list with all the types, test for the one's that you want. If you find one that you don't want then don't use it, but you're gonna have test for each possible type that you don't want.

Another good way would be that, instead of using 'establishment' as the main type (this is a very common type), you select places like "museum", "point_of_interest", and many others. Take a look at the full list here.

For each Place you get, use getPlaceTypes() which will return a list of types, which you can test for your desired type.

Upvotes: 1

Related Questions