强制 Google 地图 v2 api 刷新自定义图标图像
我使用的是 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&zoom=6&size=100x70&sensor=false&markers=icon:http%3A%2F%2Fwww.stolencamerafinder.com%2Fimages%2Fpin-lost.png%7C51.86654,-2.2480254">
我可以通过向我的图标网址添加一个无意义的参数来欺骗它来获取它(例如:“ ?a=a") :
<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">
但是我不想为此重新部署我的应用程序。我的问题是:
- 有什么方法可以请求 Google 刷新缓存吗?
- 有谁知道更新可能需要多长时间(如果有的话)?
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") :
<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:
- Is there some way to request that Google refresh their cache?
- Does anyone know how long it may take to get updated (if at all)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 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.