google maps - get state name by city or zip input

1.6k Views Asked by At

how is it possible to get the name of the state by entering a zip or city name?

for example:

city name: buffalo

get state name: new york

thanks for your help.

1

There are 1 best solutions below

0
On

You can use the Geocoding API to try to get the info. For example see a Geocode request for buffalo and in the response the administrative_area_level_1 is "New York"