refresh / update overlay image with same name on request, networklink interval or changing the url can't be applied

124 views
Skip to first unread message

mninoruiz

unread,
Jun 1, 2011, 10:17:49 PM6/1/11
to Google Maps JavaScript API v3
Hi everyone!
I have the following challenge, and wondered if anyone could suggest a
workaorund...
My clear example is here:
http://ccviz.sli.unimelb.edu.au/testMaps3.html

I need to refresh a map image on request, my challenge is that this
image is given as a WMS service response from Geoserver (for ease in
testing, I put another image available on internet that refreshes
every minute, you can try it in your browser on separate window).
Geoserver, like this example, will always give the image the same name
(i.e. same url). That's why I can't use something like
var url='http://www.meteorologica.info/lightning/lightning.jpg?rand='
+ Math.floor(Math.random() * 99999);
Which works, but geoserver, as per WMS specification, will always
serve a "[url]/wms.png" image.

I haven't found a way for google Maps to reload that image as a
GroundOverlay. I also tried with a kml with networklink
refreshInterval set. Again, because the kml produced by geoserver has
a link to that wms image (is a raster map). No matter how many new
javascript objects do I create, it seems that gmaps caches the same
image url to the same name, even if the actual image has changed or
the javascript object is new.

Just in case I tried with the previous google Maps, but same thing
happens (http://ccviz.sli.unimelb.edu.au/testMaps2.html)
I'll appreciate any suggestions, best regards,
Marcos

meetamit

unread,
Jun 2, 2011, 4:20:44 PM6/2/11
to Google Maps JavaScript API v3
I'm not familiar with WMS services, and I didn't really understand why
you can't use the "rand=12345" method for forcing the browser to re-
request the image. You say that it always serves "[url]/wms.png". So
what?

What matters is forcing the browser to re-query for the image. Without
the random param, the browser never even tries to re-query the image.
If you view your example with the Chrome developer panel, it looks
like the browser never bothers to "call" the server a second time to
check if the image has changed. This is not a google maps feature,
it's a browser feature.

So.... Did you actually try to add the random param to the query and
see it fail, or are you just assuming it's not possible?

Again, maybe I'm way off, but something here doesn't make sense to me.

mninoruiz

unread,
Jun 3, 2011, 3:11:10 AM6/3/11
to Google Maps JavaScript API v3
Hi Amit,
I did tried it, not just assumed, but I must admit that you were
right, my original code is of course much more complex using arrays of
objects instead of the var url, I must have been doing a mistake in
the creation of objects because when I replaced the random numbers in
this example (that I made only for this group), it worked! sorry about
that and thank you very much for your time.
Regards

taviram

unread,
Jan 26, 2016, 4:49:18 AM1/26/16
to Google Maps JavaScript API v3
Hello,
I'm trying to deal with same problem for few weeks
random what made it work! 

Thanks!!!
Reply all
Reply to author
Forward
0 new messages