正确的地址格式可从 google GeoCoding API 获得最准确的结果
是否有任何标准格式可以向 Google GeoCoding API 提供地址字符串,以获得地图上最准确的结果。
对于例如。以下查询未给出正确的结果。
http://maps /xml?address=bloom,Bloomfield,CT,06002,USA&sensor=false
谢谢曼迪普
.googleapis.com/maps/api/ geocode
Is there any standard format to supply the address string to Google GeoCoding API to get the most accurate results on map.
For Eg. following query not giving correct result.
http://maps.googleapis.com/maps/api/geocode/xml?address=bloom,Bloomfield,CT,06002,USA&sensor=false
Thanks
Mandeep
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我相信建议的格式是:
显然,您可以提供的信息越少,结果就越不具体。
在您的示例中,地理编码器正在搜索名为“bloom”的街道,其中在 OH 而不是 CT 中有类似的匹配项。从查询中删除“bloom”,然后搜索将返回 Bloomfield, CT。
I believe the suggested format is:
The results get less specific the less information you can supply, obviously.
In your sample, the geocoder is searching for a street named 'bloom', of which there are similar matches in OH instead of CT. Removing 'bloom' from the query and then searching returns Bloomfield, CT.
Google 地址搜索的定义:
地址 - 您要进行地理编码的街道地址,采用相关国家/地区的国家邮政服务使用的格式。应避免使用其他地址元素,例如企业名称和单位、套房或楼层号码。
https://developers.google.com/maps/documentation/geocoding/#geocoding
我应该如何格式化地理编码器查询以最大限度地增加成功请求的数量?
地理编码器旨在将街道地址映射到地理坐标。因此,我们建议您按照以下准则设置地理编码器请求的格式,以最大程度地提高查询成功的可能性:
https://developers.google.com/maps/faq#geocoder_queryformat
Definition of Google address search:
address - The street address that you want to geocode, in the format used by the national postal service of the country concerned. Additional address elements such as business names and unit, suite or floor numbers should be avoided.
https://developers.google.com/maps/documentation/geocoding/#geocoding
How should I format my geocoder queries to maximise the number of successful requests?
The geocoder is designed to map street addresses to geographical coordinates. We therefore recommend that you format geocoder requests in accordance with the following guidelines to maximise the likelihood of a successful query:
https://developers.google.com/maps/faq#geocoder_queryformat
我发现答案不完整并且缺乏来源。
请查看此处:https://developers.google.com/places/documentation/autocomplete#place_autocomplete_responses< /a>
谷歌的地图自动完成 API 返回一个更简单的格式:“街道地址、城市、国家”
现在您可以使用这样的字符串来搜索地址,它应该会产生一个准确的结果。
此外,如果您使用自动完成 API,您还将获得一个唯一标识符,可用于进一步的详细请求。
街道地址的格式很大程度上取决于您实际所在的位置。
在美国“门牌号、街道方向、街道名称、街道后缀”可能有意义,在欧洲大部分地区它不会导致成功的查询。
欧盟大部分地区的地址都不同(通常是“街道名称后缀”),例如“Kumpelstraat 25A”、“Psolevcu 331/26b”),我想如果我们看看一些东方国家,我们会感到惊讶。
因此,如果您将代码绑定到单个区域(美国、欧盟大部分地区),您可能会很好地对格式进行硬编码。
如果您想拥有一个更灵活的系统,您要么需要为您的目标受众找出正确的格式,要么查询谷歌 API 之一以自动获取正确的字符串。
我链接的那个非常好,但需要一个 API 密钥,每天有免费请求限制。
I found the answer incomplete and it lacked a source.
Look here: https://developers.google.com/places/documentation/autocomplete#place_autocomplete_responses
The maps autocompletion API from google returns a much simpler format: "Street address, City, Country"
Now you can use a string like that to search for an address and it should lead to one exact result.
In addition if you use the autocompletion API you will get a unique identifier too which can be used for further detail requests.
The format of the street address greatly depends on the location where you actually are.
In the US "House number, street direction, street name, street suffix" might make sense, in most of Europe it will not lead to successful query.
Addresses in most of EU are different (often "Streetname number suffix") like "Kumpelstraat 25A","Psolevcu 331/26b") and I guess we'd be surprised if we look at some eastern countries.
So if you bind your code to a single area (US, most of EU) you might be good hardcoding the format.
If you want to have a more flexible system you either need to find out propper formating for your target audience or query one of googles APIs to automatically get a proper string.
The one I linked is very good but requires an API key with a free request limit per day.
我偶然发现了这个问题,找到了一个对我有用的解决方案:
我认为可以通过使用组件过滤找到答案,看看:
https://developers.google.com/maps/documentation/geocoding/#ComponentFiltering
Javascript 中的示例:
I stumbled upon this question and found a solution that worked for me:
I think the answer can be found by using component filtering, look at:
https://developers.google.com/maps/documentation/geocoding/#ComponentFiltering
An example in Javascript:
无需避开公寓单位。此方法有效:
https: //maps.googleapis.com/maps/api/geocode/xml?address=14202+N+42nd+St+Unit+301+33613
“Apt”、“Room”和“Suite”也可以工作。
它们都返回 301 作为子前提,并在“formatted_address”中显示为“#301”。
保罗送...
No need to avoid apartment units. This works:
https://maps.googleapis.com/maps/api/geocode/xml?address=14202+N+42nd+St+Unit+301+33613
"Apt", "Room", and "Suite" work as well
They all return 301 as subpremise and are shown in "formatted_address" as "#301."
Paul sends...
我发现“US”、“DE”、“FR”等官方国家代码效果不佳。用完整的国家/地区名称替换它们会给我带来更好的结果。
我没有找到这样的来源。
I found that official country codes like "US", "DE", "FR" do not work well. Replacing them with the full country name gives much better results for me.
I did not find a source where that is stated.