Google's Geocoder returns wrong country, ignoring the region hint

后端 未结 13 1019
孤城傲影
孤城傲影 2020-12-07 21:03

I\'m using Google\'s Geocoder to find lat lng coordinates for a given address.

    var geocoder = new google.maps.Geocoder();
    geocoder.geocode(
    {
            


        
13条回答
  •  萌比男神i
    2020-12-07 21:42

    Use componentRestrictions attribute:

    geocoder.geocode({'address': request.term, componentRestrictions: {country: 'GB'}}
    

提交回复
热议问题