How to resolve Google Maps API warning "X-Staticmap-Api-Warning: Error geocoding: center, marker 1"?

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

How to resolve Google Maps API warning "X-Staticmap-Api-Warning: Error geocoding: center, marker 1"?

问题

Google地图静态API返回200响应,但图像为空,右上角有一个黄色丝带,显示错误消息:"Maps error: g.co/staticmaperror"。

ChromeDevTools响应标头中有这个信息:

X-Staticmap-Api-Warning: Error geocoding: center, marker 1

他们的错误消息页面描述如下:

在尝试对请求进行地理编码时发生错误。根据失败的元素(center、marker、visible或path)以及失败的元素数量,此消息有多种变体。其中一个示例是X-Staticmap-API-Warning:Error geocoding: marker 1,如上面的示例所示。

但它没有解释如何解决这个问题。有人解决了吗?

英文:

For some addresses, google maps static api returns a 200 response, but image shows up blank with a yellow ribbon at the top right with this error message: "Maps error: g.co/staticmaperror":

How to resolve Google Maps API warning "X-Staticmap-Api-Warning: Error geocoding: center, marker 1"?

Here is an example URL.

ChromeDevTools Response Headers has this:

X-Staticmap-Api-Warning: Error geocoding: center, marker 1

Their error message page has this description:
> An error occurred while attempting to geocode the request. There are many variants of this message, depending on the element where geocoding failed (center, marker, visible, or path) and the number of elements that failed. One example of this warning is X-Staticmap-API-Warning:Error geocoding: marker 1, as shown in the above example.

But it doesn't explain how to fix this issue. Has anyone resolved this?

答案1

得分: 1

"An error occurred while attempting to geocode the request"通常意味着在对给定的地址进行地理编码时未找到结果,在本例中,centermarker 1 的地址都不完整:"4606 Hickory Hill Ln"。

Static Maps API 在底层使用Geocoding API来对地址进行地理编码。正如地理编码地址最佳实践中所解释的那样,在对完整地址进行地理编码时,请使用Geocoding API。

英文:

An error occurred while attempting to geocode the request usually means no result was found when geocoding the given addresses, in this case the address for (both) center and marker 1 is incomplete:
4606 Hickory Hill Ln.

The Static Maps API uses the Geocoding API under the hood to geocode addresses. As explained in Geocoding Addresses Best Practices, use the Geocoding API when geocoding complete addresses.

答案2

得分: 0

Professor Abronsius所评论,提供详细的地址有助于解决此问题。

英文:

As commented by Professor Abronsius, providing a descriptive address helps fix this.

huangapple
  • 本文由 发表于 2023年6月8日 14:07:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76429028.html
匿名

发表评论

匿名网友

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

确定