Search code examples
google-mapsmapsgoogle-maps-markersgoogle-maps-api-2

Force Google maps v2 api to refresh custom icon image


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&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: "?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&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)?

Solution

  • 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.