Search code examples
javascriptgoogle-mapsgoogle-maps-autocomplete

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


Solution

  • 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.