Geolocation 当我使用谷歌地理编码软件时,我得到了一个关于汤姆多姆城市的虚假的lat long

Geolocation 当我使用谷歌地理编码软件时,我得到了一个关于汤姆多姆城市的虚假的lat long,geolocation,geocoding,google-geocoder,Geolocation,Geocoding,Google Geocoder,我的剧本 <script type="text/javascript"> // .... //.... var adresse = jQuery.trim(region) + ", " +jQuery.trim(adresse) + ", " + jQuery.trim(codePostal) + ", " + jQuery.trim(ville) + ", " + jQuery.trim(pays); var geocoder = new google.maps.Geocod

我的剧本

<script type="text/javascript">
// ....
//....

var adresse = jQuery.trim(region) + ", " +jQuery.trim(adresse) + ", " + jQuery.trim(codePostal) + ", " + jQuery.trim(ville) + ", " +  jQuery.trim(pays);

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

                    geocoder.geocode({ address: adresse, region: 'no' },
                    function (coords, status) {
                         if (status.toLowerCase() == 'ok') {
                                var lat = coords[0].geometry.location.lat();
                                var lon = coords[0].geometry.location.lng();    
                                console.log("lat :"+lat+",  lon :"+lon);

                         }
                         else {
                            alert("address not found");
                         }
                    } );

</scrip>

// ....
//....
var-adresse=jQuery.trim(region)+“,”+jQuery.trim(adrese)+“,”+jQuery.trim(codePostal)+“,“+jQuery.trim(ville)+”,“+jQuery.trim(pays);
var geocoder=new google.maps.geocoder();
geocoder.geocode({地址:ADRESE,地区:'no'},
功能(协调、状态){
if(status.toLowerCase()=='ok'){
var lat=coords[0]。geometry.location.lat();
var lon=coords[0]。geometry.location.lng();
log(“lat:+lat+”,lon:+lon);
}
否则{
警报(“未找到地址”);
}
} );
我有一个问题latlong法国的dom tom地区,我有latlong false当我插入此地址 法国圣丹尼斯波夫里埃街9号拉雷联盟,邮编:97400 我喜欢latlong=>(lat:48.936181,lon:2.35744299999893),但它是假的

我希望有人能找到解决办法,如果有的话,谢谢你的帮助
(对不起我的英语!)

我终于找到了解决办法,只需将国家排除在海外地区 就像这样:

<script type="text/javascript">
// ....
//....

if(jQuery.trim(pays) == 'France'){
var adresse = jQuery.trim(region) + ", " +jQuery.trim(adresse) + ", " + jQuery.trim(codePostal) + ", " + jQuery.trim(ville);
}
else{
var adresse = jQuery.trim(region) + ", " +jQuery.trim(adresse) + ", " + jQuery.trim(codePostal) + ", " + jQuery.trim(ville) + ", " +  jQuery.trim(pays);
}

//...

</script>

// ....
//....
如果(jQuery.trim(pays)=‘法国’){
var-adresse=jQuery.trim(region)+“,“+jQuery.trim(adrese)+”,“+jQuery.trim(codePostal)+”,“+jQuery.trim(ville);
}
否则{
var-adresse=jQuery.trim(region)+“,”+jQuery.trim(adrese)+“,”+jQuery.trim(codePostal)+“,“+jQuery.trim(ville)+”,“+jQuery.trim(pays);
}
//...

非常感谢你AlexWien

有多假?多少米,千米?这不是米或公里的问题。。。但我有经度和纬度,这与我的地址“法国圣丹尼斯波夫里埃街9号Réunion,97400号”(感谢您抽出时间回答)不符。这是我的问题:测量错误的纬度、长度和正确的纬度之间的距离,长。你可以看到我的截图总距离:5829.125,准确的纬度和经度:-20.88,55.45