【问题标题】:Geocoding API is not reliable地理编码 API 不可靠
【发布时间】:2015-04-20 18:50:38
【问题描述】:

我遇到了 bing 地图地理编码 API 的问题。 API 不可靠。相同的查询不会总是返回相同的结果。

这个查询 http://dev.virtualearth.net/REST/v1/Locations/?key=myKey&o=xml&countryRegion=CA&postalCode=g0a4b0

不会返回地址

<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">
<Copyright>
Copyright © 2015 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.
</Copyright>
<BrandLogoUri>
http://dev.virtualearth.net/Branding/logo_powered_by.png
</BrandLogoUri>
<StatusCode>200</StatusCode>
<StatusDescription>OK</StatusDescription>
<AuthenticationResultCode>ValidCredentials</AuthenticationResultCode>
<ResourceSets>
<ResourceSet>
<EstimatedTotal>0</EstimatedTotal>
<Resources/>
</ResourceSet>
</ResourceSets>
</Response>

或地址

<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">
<Copyright>
Copyright © 2015 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.
</Copyright>
<BrandLogoUri>
http://dev.virtualearth.net/Branding/logo_powered_by.png
</BrandLogoUri>
<StatusCode>200</StatusCode>
<StatusDescription>OK</StatusDescription>
<AuthenticationResultCode>ValidCredentials</AuthenticationResultCode>
<ResourceSets>
<ResourceSet>
<EstimatedTotal>1</EstimatedTotal>
<Resources>
<Location>
<Name>G0A 4B0, QC</Name>
<Point>
<Latitude>46.679374694824219</Latitude>
<Longitude>-72.049674987792969</Longitude>
</Point>
<BoundingBox>
<SouthLatitude>46.675511977253542</SouthLatitude>
<WestLongitude>-72.0571812840852</WestLongitude>
<NorthLatitude>46.683237412394895</NorthLatitude>
<EastLongitude>-72.042168691500734</EastLongitude>
</BoundingBox>
<EntityType>Postcode1</EntityType>
<Address>
<AdminDistrict>QC</AdminDistrict>
<AdminDistrict2>Portneuf</AdminDistrict2>
<CountryRegion>Canada</CountryRegion>
<FormattedAddress>G0A 4B0, QC</FormattedAddress>
<Locality>Saint-Marc-des-Carrières</Locality>
<PostalCode>G0A 4B0</PostalCode>
</Address>
<Confidence>High</Confidence>
<MatchCode>Good</MatchCode>
<GeocodePoint>
<Latitude>46.679374694824219</Latitude>
<Longitude>-72.049674987792969</Longitude>
<CalculationMethod>Rooftop</CalculationMethod>
<UsageType>Display</UsageType>
</GeocodePoint>
</Location>
</Resources>
</ResourceSet>
</ResourceSets>
</Response>

有没有办法让 Bing 地理编码 API 更可靠?

是因为我使用了基本密钥,而他们因为服务器过载而拒绝了我的查询?

谢谢

【问题讨论】:

  • 我投票结束这个问题,因为它是关于 Bing API 的,它只说“它不能像我想要的那样工作”,这应该问微软......

标签: rest geocoding bing bing-maps


【解决方案1】:

您的陈述不正确,因为您似乎没有遵守您在创建基本密钥时同意的使用条款。

这些类型的密钥在给定时间段内的请求数量受到限制,这是 MSDN 上的一篇精确文章,详细解释了这些限制:

https://msdn.microsoft.com/en-us/library/dn894107.aspx

关于状态和代码的另一个:

https://msdn.microsoft.com/en-us/library/ff701703.aspx

速率限制和信息

这是进一步管理错误的有趣部分:

速率限制

在 Bing Maps 使用条款中,试用和基本密钥是 他们可以在一个范围内生成的交易数量受到限制 一段的时间。 Windows 应用商店、Windows Phone 和 WPF 应用程序具有 24 小时内最多 50,000 笔交易。面向公众的网络 网站和非 Windows 移动应用程序的交易次数上限为 125,000 一年。速率限制发生在发出请求的频率时 帐户针对 Bing 地图 REST 和/或 SOAP 服务的次数超过 这些免费的使用条款。速率限制也可能发生时 服务负载很大。这样做是为了确保 试用和基本密钥的使用不会中断这些人的服务 使用企业密钥。企业密钥不受速率限制,并且 绕过速率限制的唯一方法是升级到 Enterprise 钥匙。有关更多信息,请参阅我们的 Bing 地图许可选项 页面。

当请求是速率限制时,响应将返回 no 结果。起初这可能会让人感到困惑,因为 Bing Maps 似乎是 无法找到结果。表示请求受到速率限制 一个标志被添加到响应的头部(X-MS-BM-WS-INFO),它 设置为 1 的值,如状态代码和错误中所述 处理页面。为了提供更好的用户体验,应用程序 使用试用或基本密钥应在标题中查找此标志,并且 处理速率受限的请求。像记录一样简单的事情 请求在您的应用程序日志中受到速率限制的事实可能 在调试报告的问题时提供帮助。

【讨论】:

  • 所以不可靠。我不能想当然地认为查询的结果是相同的。
  • 限速查询是否计入我的年度查询限额?
  • 速率限制包括所有限制(每小时/每天/每年)。只要您在适当且可接受的限制内使用,它就是可靠的。
  • 有时我一天中的第一个查询不起作用。这是因为他们不想中断企业密钥的服务。
  • 那么您应该考虑通过 Microsoft Bing 地图门户(您生成密钥的地方)通过电子邮件联系支持人员,并使用适当的日志进行解释。此外,如果您有很多请求要做,您可以考虑使用 Bing Maps Batch Geocode。
【解决方案2】:

还有很多其他的地理编码提供商。如果您的应用程序必须能够依赖快速、可扩展且可靠的地理编码提供商,您最终可能会为高级服务付费。

GeoCoding providers for non-map use

【讨论】:

  • 在这种情况下没有真正回答问题
猜你喜欢
  • 2015-05-05
  • 1970-01-01
  • 2015-06-15
  • 2018-05-27
  • 1970-01-01
  • 1970-01-01
  • 2016-08-31
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多