开发者

Force Google maps v2 api to refresh custom icon image

开发者 https://www.devze.com 2023-04-12 12:07 出处:网络
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

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

Force Google maps v2 api to refresh custom icon image

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&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">

I can trick it into fetching it by adding a nonsense parameter to my icon url (eg: "?开发者_如何学Goa=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&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">

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)?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号