I have implemented Google Places API with autocomplete and Google Geocoding Api. The problem is that it seems that the results do not work correctly.
Sometimes some of the choosen results from the autocomplete list do not geocode at all, all i get is the status ZERO_RESULTS.
I know that there could be some problems regarding the fact that Google Autocomplete uses also Places, while Google Geocode uses only postal codes, but how could i limit autocomplete to give me only postal codes results.
The Geocoding API is a service that provides geocoding and reverse geocoding of addresses. This service is also available as part of the client-side Google Maps JavaScript API, or for server-side use with the Java Client, Python Client, Go Client and Node. js Client for Google Maps Services.
The Places API is a service that returns information about places using HTTP requests. Places are defined within this API as establishments, geographic locations, or prominent points of interest.
Google Maps and Google Places API can be primarily classified as "Mapping APIs" tools. According to the StackShare community, Google Maps has a broader approval, being mentioned in 2501 company stacks & 6357 developers stacks; compared to Google Places API, which is listed in 12 company stacks and 5 developer stacks.
You may restrict results from a Place Autocomplete request to be of a certain type by passing a types parameter. The parameter specifies a type or a type collection, as listed in the supported types below. If nothing is specified, all types are returned. In general only a single type is allowed. The exception is that you can safely mix the geocode and establishment types, but note that this will have the same effect as specifying no types. The supported types are:
establishment instructs the Place Autocomplete service to return only business results. the (regions) type collection instructs the Places service to return any result matching the following types:
Hope this helps https://developers.google.com/places/documentation/autocomplete
There is no way to achieve it via an Autocomplete.
When you type in a autocomplete the API first will request the predictions, but not the details.
This means that at the time when you see the predictions it's still not clear if there are details available for this place.
There are cases when the particular place can't be found. I'm sure when it would be possible for google to exclude the missing places they wouldn't return them at all.
The only workaround I see would be to create the autocomplete on your own by requesting both, predictions and details , before you apply the predictions. But note: each time the user types into the input this will count as 6 requests(assuming 5 predictions will be returned)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With