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

后端 未结 13 1007
孤城傲影
孤城傲影 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:49

    I had to filter results to a country myself today. I found out that the two character country code in componentRestrictions:country: does not work. But the full country name does.

    This is the full_name in the address_components from a result.

提交回复
热议问题