地理编码服务和gMap上的搜索之间的差异结果 [英] Difference results between Geocoding services and search on gMap

查看:85
本文介绍了地理编码服务和gMap上的搜索之间的差异结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得这个地址的经纬度:法国COULOMMIERS,COULOMMIERS Boulevard de la Marne Zone industrielle



我将api添加到我的页面:

 < script src =https://maps.googleapis.com/maps/api/js?v = 3.exp&安培;传感器=真>< /脚本> 

当我使用gmaps时,结果很好,但是当我想通过API检索时:

  geocoder = new google.maps.Geocoder(); 
geocoder.geocode({'address':myAdress,'region':'FR'},function(results,status){...});

它执行以下请求:

  https://maps.googleapis.com/maps/api/js/GeocodeService.Search?4sBoulevard%20de%20la%20Marne%20%20Zone%20industrielle%20%20COULOMMIERS%2077120%20& ; 7sUS& 9sfr-FR& callback = _xdc _._ lsoj9s& token = 53058 

并且结果接近Bamako ...



如果我使用视口范围,它会执行以下请求:

  https://maps.googleapis.com/maps/api/js/GeocodeService.Search?4sBoulevard%20de%20la%20Marne%20%20Zone%20industrielle%20%20COULOMMIERS%2077120%20&6m6&1m2& ; 1d40.513799& 2d-5.844727000000034& 2m2& 1d51.727028& 2d10.854491999999936& 7sUS& 9sfr-FR& callback = _xdc _._ c84svr& token = 29019 

更好的是(它在法国),但并不是这样的

查询在网站google map上效果很好:
https://maps.google.fr/maps q =大道+的+ LA + ++马恩区+工业公司,++的Coulommiers,+ 77120&安培; HL = FR&安培; 11 =&48.487486,3.922119放大器; SPN = 1.541855,4.22699&安培; SLL = 50.485474,25.620117&安培; SSPN =
23.748757,67.631836& hq = Boulevard + de + la + Marne ++ Zone + industrielle,++ COULOMMIERS,+ 77120& radius = 15000& t = m& z = 9

看来唯一的方法是通过执行以下请求:
http://maps.googleapis.com/maps/api/地理编码/ JSON?地址=大道%20de%20LA%20Marne%20Zone%20industrie lle,%20COULOMMIERS,%2077120& components = country:FR& sensor = false

我不明白为什么当我使用视口而不是国家(这两个结果在视口范围内)

解决方案

Boulevard de la Marne Zone industrielle,COULOMMIERS ,77120,法国不是地址,它是一个地点。



地理编码器从该输入中找到Via De La Marne的位置:



http://www.geocodezip.com/v3_example_geo2 .asp?addr1 = Boulevard de la Marne Zone industrielle,COULOMMIERS,77120,France& geocode = 1

 找到1结果Boulevard de la Marne Zone industrielle,COULOMMIERS,77120,法国
[0]:Av De La Marne,Bamako,Mali(12.6417952,-7.988396299999977)
pre>

Places API的第一个结果看起来更相关ct:

http:// www.geocodezip.com/v3_example_geo2.asp?addr1=Boulevard de la Marne Zone industrielle,COULOMMIERS,77120,France& place = 1

 找到20条结果Boulevard de la Marne Zone industrielle,COULOMMIERS,77120,法国
[0]:Zone Industrielle,Boulevard de la Marne,Coulommiers,France(48.804329,3.0923729999999523)
[1]:Boulevard de la Marne,Coulommiers,France(48.803048,3.092110000000048)
[2]:21 Boulevard de la Marne,Coulommiers,France(48.806634,3.0937430000000177)
...


I want to get the latitude and longitude for this adress : Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France

I'm adding the api to my page with :

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true"></script>

When I use gmaps the result is good but when I want to retrieve it by the API :

 geocoder = new google.maps.Geocoder();
 geocoder.geocode({ 'address': myAdress, 'region': 'FR'}, function (results, status) {...});

It does the following request :

https://maps.googleapis.com/maps/api/js/GeocodeService.Search?4sBoulevard%20de%20la%20Marne%20%20Zone%20industrielle%20%20COULOMMIERS%2077120%20&7sUS&9sfr-FR&callback=_xdc_._lsoj9s&token=53058

and the result is near Bamako...

If I use the viewport bounds it does the following request :

https://maps.googleapis.com/maps/api/js/GeocodeService.Search?4sBoulevard%20de%20la%20Marne%20%20Zone%20industrielle%20%20COULOMMIERS%2077120%20&6m6&1m2&1d40.513799&2d-5.844727000000034&2m2&1d51.727028&2d10.854491999999936&7sUS&9sfr-FR&callback=_xdc_._c84svr&token=29019

It's better (it's in France) but it's not that

The query works well on the website google map : https://maps.google.fr/maps?q=Boulevard+de+la+Marne++Zone+industrielle,++COULOMMIERS,+77120&hl=fr&ll=48.487486,3.922119&spn=1.541855,4.22699&sll=50.485474,25.620117&sspn=23.748757,67.631836&hq=Boulevard+de+la+Marne++Zone+industrielle,++COULOMMIERS,+77120&radius=15000&t=m&z=9

It seems that the only way to get it is by doing the following request : http://maps.googleapis.com/maps/api/geocode/json?address=Boulevard%20de%20la%20Marne%20Zone%20industrielle,%20COULOMMIERS,%2077120&components=country:FR&sensor=false

I don't understand why the result are different when I use the viewport and not the country (the two results are in the bounds of the viewport)

解决方案

Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France is not an address, it is a "place".

The geocoder finds the location of Via De La Marne from that input:

http://www.geocodezip.com/v3_example_geo2.asp?addr1=Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France&geocode=1

Found 1 results for Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France
[ 0 ]: Av De La Marne, Bamako, Mali (12.6417952, -7.988396299999977)

The first result from the Places API looks more correct:

http://www.geocodezip.com/v3_example_geo2.asp?addr1=Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France&place=1

Found 20 results for Boulevard de la Marne Zone industrielle, COULOMMIERS, 77120, France
[ 0 ]: Zone Industrielle, Boulevard de la Marne, Coulommiers, France (48.804329, 3.0923729999999523)
[ 1 ]: Boulevard de la Marne, Coulommiers, France (48.803048, 3.092110000000048)
[ 2 ]: 21 Boulevard de la Marne, Coulommiers, France (48.806634, 3.0937430000000177)
...

这篇关于地理编码服务和gMap上的搜索之间的差异结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆