Search code examples
google-mapsgoogle-places-api

Google places api only include results that have postal_code


Is there a way of having a search input where a user can type a city name and it only returns results that have a postal code? For this particular situation we don't want the user to enter the full address. The fields we need are City, Postal code and Country. I know we can limit the results by setting the flag types=(cities) but when searching for city name the first results never include the postal_code. I though of doing a reverse lookup with the provided city coordinates but some cities have more than one postal codes.


Solution

  • It's not currently possible to filter places from Place Autocomplete predictions on postal codes only.

    However, there is an open feature request in Google's Issue Tracker which I suggest starring to increase visibility and subscribe to future notifications:

    https://issuetracker.google.com/issues/35822067

    Hope this helps!