I have dynamically generated KML files that I would like to display on Google Maps. This is the easy part, I did it several times earlier, no problem.
I want KML files to be cached by Google for the request. That is, if a person visits a page with a Google Maps attachment in which my KML is loaded and displayed, I want this KML file to be used to load this page. But if the user needs to refresh the page (having the same Google maps URL), I would like the KML file to be reloaded.
The simple โjust add the timestamp argumentโ does not work, since I will not control the URLs submitted to Google Maps on the page (only most of the URLs).
Looking at the <Link> and <networkLink> , they seem to allow you to control expiration, caching, updating, etc. on an external resource. Reading the documentation, it would seem that using <refreshMode>onChange<refreshMode> to use a two-layer approach will give me what I want.
After checking this, Google does not actually update the contents of the linked KML file even after 10-20 minutes and reloads several maps (when I provide the same URL in the Maps search field).
These are the KML files that I use:
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <NetworkLink> <Link> <href>URL</href> <refreshMode>onChange</refreshMode> </Link> </NetworkLink> </Document> </kml>
...
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <Placemark> <name>NAME</name> <visibility>1</visibility> <Style> STYLE </Style> GEOMETRY </Placemark> </Document> </kml>
... With URL, NAME, STYLE and GEOMETRY replaced with the correct content. Does anyone have an idea of โโwhat I can do wrong? Or maybe what I want?