Subham Rajput
Subham Rajput

Reputation: 22

Google Places API gives name of the state as city in the suggestion

We are using google places API to autocomplete state, city or region searches. The issue is when one searches for a state, Places API gives two results one for the state and the other for the city/region. For eg, if we search Maine we get Maine, USA and Maine, ME, USA both in the response. Would anyone please provide a way to avoid this duplication?

Upvotes: -2

Views: 820

Answers (1)

Kellad
Kellad

Reputation: 678

Do you use "types" parameter? https://developers.google.com/maps/documentation/places/web-service/autocomplete#types "cities" type might give the result you want.

Upvotes: 1

Related Questions