Michael Samteladze
Michael Samteladze

Reputation: 1330

Google Places Autocomplete Not Searching Address

I'm using google autocomplete in my application for address search. I'm typing my address but results are not found for it mitskevichi 14. But if I go to google maps website and type same address there, result is found.

I've tried, mitskevichi 14 with any possible setups for

https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete

and

https://developers.google.com/maps/documentation/javascript/examples/places-searchbox

and couldn't get any results. When I try

https://www.google.com/maps

I Get results.

Any ideas how to solve this problem?

Here is my sample

var Autocomplete = new google.maps.places.Autocomplete(document.getElementById('GoogleAutocomplete'));    

https://jsfiddle.net/b4nz6Lk5/3/

enter image description here

enter image description here

enter image description here

Upvotes: -1

Views: 2620

Answers (2)

Alukret
Alukret

Reputation: 91

in Google maps documentation there is an example with options like: types: ["establishment"]

I changed it to: types: ["address"] and autocomplete starts to show all addresses

Upvotes: 1

Michael Samteladze
Michael Samteladze

Reputation: 1330

I finally found a solution. I used two type of google services:

var Service = new google.maps.places.AutocompleteService();
var Request = { input: "mitskevichi 14", language:'en', types: ['geocode'] };
Service.getPlacePredictions(Request, function (Results, Status) {     
    ...
});

And

var Service = new google.maps.Geocoder();
var Request = { address: 'mitskevichi 14', region: 'GE' };
Service.geocode(Request, function (Results, Status) {
    ...
});

Combined results from both and get what I initially wanted.

Upvotes: 0

Related Questions