Google 的移动设备放置的自动完成结果与桌面设备结果不同

Google's mobile places autocomplete results different than desktop results

我使用 Google 个地方 api,如此处 https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete 所示。 我的代码如下:

var options = {
    componentRestrictions: {country: "gr"}
};

var element = document.getElementById('place');
var placeAuto = new google.maps.places.Autocomplete(element, options);

google.maps.event.addListener(placeAuto, 'place_changed', function() {
    var place = placeAuto.getPlace();

    if (!place.geometry) {
        return;
    }

    $('#lat').val(place.geometry.location.lat())
    $('#lon').val(place.geometry.location.lng())

});

移动设备上的地点建议与桌面应用程序上的不同。有什么方法可以得到相同的结果吗?

您没有指定位置偏差,因此 Google 地点 API 将尝试猜测位置 from the IP address:

Note: If you do not supply any bounds or a map viewport, the API will attempt to detect the user's location from their IP address, and will bias the results to that location. If you would prefer to have no location bias, set the bounds to encompass the whole world: (-90,-180),(90,180).

所以提供一个明确的位置,你会看到独立于 IP 地址的一致结果。