Azure Maps SearchAddressResultItem.Address.FreeFormAddress不完整。

huangapple go评论59阅读模式
英文:

Azure Maps SearchAddressResultItem.Address.FreeFormAddress is incomplete

问题

我正在使用Azure Maps获取已纠正的地址及其位置。FreeFormAddress不太好,因为:

  1. 它不包括国家。
  2. 它只有5位数字的邮政编码,没有5+4位。
  3. 它是一行,不符合人们的期望。

有办法获取完整的地址,包括国家、完整的邮政编码等,并使用\n适当地换行,以便按照信封的格式放置吗?

我可以从SearchAddressResultItem.Address构建一个对美国正确的字符串。但我怀疑它在越南等国家是否正确。

英文:

I am using Azure Maps to get back a corrected address and its location. The FreeFormAddress is not great because:

  1. It does not include the country.
  2. It has just the 5 digit zip, not the 5+4.
  3. 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:

huangapple
  • 本文由 发表于 2023年5月21日 16:52:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76299043.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定