Google maps 使用谷歌地图API对乌克兰邮政编码进行地理编码的最佳方法?

Google maps 使用谷歌地图API对乌克兰邮政编码进行地理编码的最佳方法?,google-maps,google-maps-api-3,geocoding,Google Maps,Google Maps Api 3,Geocoding,对乌克兰邮政编码进行地理编码最有效、最准确的方法是什么?使用内置的地理编码对象会导致结果严重模糊(许多邮政编码只返回一个大致区域) 有没有免费的乌克兰邮政编码地理编码服务可以通过JavaScript插入?如果我正确理解了您的问题,您只需设置组件限制即可。可能是这样的: doGeocode: function (address, postal_code, callback) { console.log("TEST: " + address.toString()); var geoc

对乌克兰邮政编码进行地理编码最有效、最准确的方法是什么?使用内置的地理编码对象会导致结果严重模糊(许多邮政编码只返回一个大致区域)


有没有免费的乌克兰邮政编码地理编码服务可以通过JavaScript插入?

如果我正确理解了您的问题,您只需设置
组件限制即可。可能是这样的:

doGeocode: function (address, postal_code, callback) {
    console.log("TEST: " + address.toString());
    var geocoder = new google.maps.Geocoder();
    geocoder.geocode({
        'address': address,
        'componentRestrictions': {
            'postalCode': postal_code,
            'country': 'de' //change this to the Code of Ukraine 
        }
    }, function (results, status) {
        if (status === google.maps.GeocoderStatus.OK) {
            console.log(results);
            callback(results);
        } else {
            //Error handling
            alert('Geocode was not successful for the following reason: ' + status);
        }
    });
注意:当然,您必须在此处设置乌克兰的国家代码。而且,因为您没有提到您有地址或lat/lng的信息,所以我只是给您举了一个地址示例