强制 Google 地图 v2 api 刷新自定义图标图像

发布于 2024-12-09 04:17:59 字数 2130 浏览 0 评论 0原文

我使用的是 Google 静态地图 API V2 创建带有自定义蓝色标记图标的地图:

不幸的是,我在我的自定义图像上线之前测试了该网址,并且 Google 似乎以某种方式缓存了该知识:

http://maps.googleapis.com/maps/api/staticmap?center=51.86654,-2.2480254&zoom=6&size=100x70&s ensor=false&markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png%7C51.86654,-2.2480254 (如果这个图像有一个蓝色图标,那么自从我发布这个问题以来,缓存已经更新了!)

<img src="http://maps.googleapis.com/maps/api/staticmap?center=51.86654,-2.2480254&amp;zoom=6&amp;size=100x70&amp;sensor=false&amp;markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png%7C51.86654,-2.2480254">

我可以通过向我的图标网址添加一个无意义的参数来欺骗它来获取它(例如:“ ?a=a") :

http://maps.googleapis.com/maps/api/staticmap?center=51.86654,-2.2480254&zoom=6&size=100x70&sen sor=false&markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png?a=a%7C51.86654,-2.2480254

<img src="http://maps.googleapis.com/maps/api/staticmap?center=51.86654,-2.2480254&amp;zoom=6&amp;size=100x70&amp;sensor=false&amp;markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png?a=a%7C51.86654,-2.2480254">

但是我不想为此重新部署我的应用程序。我的问题是:

  1. 有什么方法可以请求 Google 刷新缓存吗?
  2. 有谁知道更新可能需要多长时间(如果有的话)?

I am using the Google static maps API V2 to create a map with a custom blue marker icon:

Unfortunately, I tested the url before the my custom image was online and Google seems to have cached that knowledge somehow:

http://maps.googleapis.com/maps/api/staticmap?center=51.86654,-2.2480254&zoom=6&size=100x70&sensor=false&markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png%7C51.86654,-2.2480254 (if this image has a blue icon, then it the cache has been updated since I posted this question!)

<img src="http://maps.googleapis.com/maps/api/staticmap?center=51.86654,-2.2480254&zoom=6&size=100x70&sensor=false&markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png%7C51.86654,-2.2480254">

I can trick it into fetching it by adding a nonsense parameter to my icon url (eg: "?a=a") :

http://maps.googleapis.com/maps/api/staticmap?center=51.86654,-2.2480254&zoom=6&size=100x70&sensor=false&markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png?a=a%7C51.86654,-2.2480254

<img src="http://maps.googleapis.com/maps/api/staticmap?center=51.86654,-2.2480254&zoom=6&size=100x70&sensor=false&markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png?a=a%7C51.86654,-2.2480254">

However I don't want to re-deploy my app just for this. My question is:

  1. Is there some way to request that Google refresh their cache?
  2. Does anyone know how long it may take to get updated (if at all)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清音悠歌 2024-12-16 04:17:59

正如 duncan 首先注意到的那样,图像现在看起来不错。

因此,对于其他遇到此问题的人来说,我的形象花了不到一天的时间就得到了刷新。当然,YMMV。

As duncan noticed first, the image looks ok now.

So, for anyone else that has this problem, it took less than a day for my image to get refreshed. Of course, YMMV.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文