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

后端 未结 13 1010
孤城傲影
孤城傲影 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条回答
  •  北海茫月
    2020-12-07 21:24

    I find that for a lot of ambiguous queries, the US always takes precedence in Google, even if you try to tell it where to look. You can look at the response and perhaps ignore it if output country=US?

    That is the main reason I stopped using Google Geocoder a while ago and started building my own two years ago.

    https://geocode.xyz/Boston,%20UK will always return the UK location. You can make extra sure by adding region=UK: https://geocode.xyz/Boston,%20UK?region=UK

提交回复
热议问题