Google places autocomplete - location and radius not working

Viewed 10877

Im trying to set the google places autocomplete to sort the results from the nearest to a point. I have a code like this...

var defaultPlace = new google.maps.LatLng(49.227463, 16.546097);

var optionsAuto = {
    location: defaultPlace,
    radius: 20000,
    types: ['geocode'],
    componentRestrictions: {
        country: 'cz'
    }
};

var autocomplete = new google.maps.places.Autocomplete( inputStart, optionsAuto );

the types and componentRestrictions works great but the location and radius doesn't seems to be working.

3 Answers
Related