User editable layers at maps.google.com integrated into JavaScript v3 applications - how to refresh cache

129 views
Skip to first unread message

Bob Torzynski

unread,
Sep 23, 2012, 9:56:47 AM9/23/12
to google-map...@googlegroups.com
Greetings,

This question relates to embedding user-editable layers at maps.google.com into google maps javascript api v3 applications. 

In my application at: http://bike.zgroks.com/index.html, there is included a layer called as such:

rtEditLayer = new google.maps.KmlLayer(rtEditLayer_url, {preserveViewport: true});
rtEditLayer.setMap(null); 

The code above calls a map at maps.google.com that is set to allow public collaboration.

When the user wants to edit the layer at maps.google.com, this function (below) is called:

function edit_map () { 
       var mcenter = map.getCenter();
          var mlat = mcenter.lat();
          var mlng = mcenter.lng();
          var z = map.getZoom();
          var myType = map.getMapTypeId();
          var goToLoc2 = 'https://maps.google.com/maps/ms?msid=212925685488873680953.0004c4ab35f55e7bc304e&msa=0&z='  + z + '&ll=' + mlat + ',' +mlng;
          window.open(goToLoc2);
         }
         
         
This all works well and good, but changes made at maps.google.com seem to take various amounts of time to propagate to the main map.

Is it possible to add a random query string parameter to the end of the variable goToLoc2 to cause maps.google.com to refresh the cache?

Any help, or examples linking to applications employing a similar functionality would be much appreciated.

Bob

Barry Hunter

unread,
Sep 23, 2012, 10:05:30 AM9/23/12
to google-map...@googlegroups.com
>
> Is it possible to add a random query string parameter to the end of the
> variable goToLoc2 to cause maps.google.com to refresh the cache?

Dont you mean rtEditLayer_url ? Ie it is displaying the content where
the caching is happening.


rtEditLayer_url = rtEditLayer_url + "&rnd=".(Math.Random());

Bob Torzynski

unread,
Sep 24, 2012, 8:52:48 AM9/24/12
to google-map...@googlegroups.com
Yes, I am trying to update the rtEditLayer. When changes are made via maps.google.com, they take some time to show up on the map at bike.zgroks.com ... I don't know if it's reasonable to expect the updates to show up right away, but the sooner that they showed up, the better. What I'm wondering is can I put a random parameter in the rtEditLayer_url when I call it through the edit_map function and if I do that will it affect anything (i.e., does maps.google.com cache the url)

Bob

Jeff Lake

unread,
Sep 24, 2012, 9:03:09 AM9/24/12
to google-map...@googlegroups.com
yes Google caches the data ...

-Jeff Lake
MichiganWxSystem.com
AllisonHouse.com
TheWeatherCenter.net
GRLevelXStuff.com
--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/Jd1fXZOvLbYJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply all
Reply to author
Forward
0 new messages