Brandon Young
Brandon Young

Reputation: 523

NetworkLink Not Updating

First of all, I want to ask if what I did is correct regarding NetworkLinks. First, using a "kml generator", I was able to generate my kml from my database and worked well. It is saved as mykml.kml (which I tried to load in Google Maps and worked). What I did next is used the Dropbox.com to save this file publicly. Next, using NetworkLink, I pasted the URL of the link of mykml.kml from the dropbox into the of the networklink.kml file (which is shown below). Then, I added this networklink.kml in Google Maps' My Places, got the link etc. and embed it in my test website. I tested my site and it worked. However, a problem arose. When I updated my mykml.kml file and updated the dropbox, the site did not respond to the changes. Was there something that I missed doing?

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<NetworkLink>
<name>Red Cross</name>
<visibility>0</visibility>
<description>Sample Map</description>
<flyToView>1</flyToView>
<Url>
<href>http://dl.dropbox.com/u/31600404/mykml.kml</href>
<viewRefreshMode>onStop</viewRefreshMode>
<viewRefreshTime>7</viewRefreshTime>
</Url>
</NetworkLink>
</kml>

I hope that you can help me! Thanks!

Upvotes: 0

Views: 1651

Answers (1)

Eddy
Eddy

Reputation: 5370

There are a couple of things with your file and one with how you are using it:

First you should really be using <Link> instead of the deprecated <Url>
Secondly you are using the 'viewRefresh' settings of the link. These settings specify if and how the link is refreshed if the camera view is changed by the user. In your example you are using:

Refresh the file n seconds after movement stops, where n is specified in <viewRefreshTime>.

You probably want something like:

<refreshMode>onInterval</refreshMode>
<refreshInterval>60</refreshInterval>

Also have a look at the other options to check if one of those better suits your needs. See this link for more information and all the options

Not the bad news. Even if you fix the file the internet is full of people not getting this to work when using this from Google Maps (it definitely works in Google Earth) and Google has no been very forthcoming what and when works from Google Maps. The best answer I know off is this one:

Expiration and time-based refresh are generally supported, although Google Maps does not refetch content from the Internet more often than (in the order of) fractions of a minute to a few minutes. Google Maps ignores expiration settings in the HTTP headers but does use the expiration settings specified in KML. In the absence of expiration settings, or within the time validity interval, Google Maps may cache data fetched from the Internet for unspecified durations. A refetch of the data from the Internet can be forced by renaming the document and fetching it under a different URL, or by making sure that the document contains appropriate expiration settings.

Source: http://code.google.com/intl/nl-NL/apis/kml/documentation/kmlelementsinmaps.html#notes

The 'commonly accepted' workaround for this is to do the refresh from javascript using a interval and by appending an random number to the maps url to avoid getting cached results.

Upvotes: 1

Related Questions