英文:
Azure Maps SearchAddressResultItem.Address.FreeFormAddress is incomplete
问题
我正在使用Azure Maps获取已纠正的地址及其位置。FreeFormAddress不太好,因为:
- 它不包括国家。
- 它只有5位数字的邮政编码,没有5+4位。
- 它是一行,不符合人们的期望。
有办法获取完整的地址,包括国家、完整的邮政编码等,并使用\n适当地换行,以便按照信封的格式放置吗?
我可以从SearchAddressResultItem.Address构建一个对美国正确的字符串。但我怀疑它在越南等国家是否正确。
英文:
I am using Azure Maps to get back a corrected address and its location. The FreeFormAddress is not great because:
- It does not include the country.
- It has just the 5 digit zip, not the 5+4.
- It is all one line so it does not display as people expect it.
Is there a way to get the address back where its complete with country, full zip code, etc. and with \n as appropriate so it's how one would put it on an envelope?
I can build a string that's correct for the U.S. from SearchAddressResultItem.Address. But I doubt it would be correct for say Vietnam.
答案1
得分: 0
以下是已翻译的内容:
非常罕见,如果有的话,格式化的地址中将不包含国家信息。它永远不会包含邮政编码5+4。搜索API的设计是接受地址并找到其坐标。返回的任何附加信息主要是为了帮助用户验证是否返回了正确的结果,不包括地区邮寄格式化地址字符串。如果您计划专注于有限数量的国家,可以构建一些逻辑来将结构化地址部分格式化为所期望的地区邮寄地址格式。如果您想支持超过几个国家,有几个开源库提供了相当全面的邮寄地址格式化覆盖范围。以下是一些:
英文:
Very rarely, if at all will the formatted address contain country. It will never contain zip 5+4. The search API's are designed to take addresses and find the coordinate for it. Any additional information returned is primarily to assist the user in verifying that the right result was returned and does not include regional mail formatted address strings. If you have a limited number of countries in which you plan to focus on, you can build a bit of logic that formats the structured address parts into the expect regional mailing address format. If you want to support more than a couple of countries, there are several open-source libraries that have pretty comprehensive coverage for mail address formatting. Here are some:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论