Dynamic Google Earth Applications with Network Links
Over the next few posts we are going to look at a how you can serve up dynamic Google Earth applications to your end users through the use of network link functionality. Network link functionality provides a way for multiple clients to view the same network-based or web-based KMZ data and automatically see any changes to the content as those changes are made.
How it Works
Network links are functionally similar to traditional web content publishing in that they allow for the delivery of dynamic data to multiple users. By distributing traditional network links or web links to your KMZ files, users can obtain a view only reference to your data through the GE interface. As the content provider you can specify how often to refresh the data in the file through various GE tabs, KML parameters, or even CGI scripts that dynamically update the data. Data is updated only at the source and provides a single point of entry for your specific data sets. End users can also specify how often to refresh the data through the GE interface. Although end users can specify how often to refresh data from the source, they can not modify the existing KML file. It is possible, however, to save the file to their local computer. The figure below gives you a visual depiction of this process.
The advantages of sharing Google Earth data with your users through this method include accessibility (can be accessed via the web), ease of distribution, automatic data updates, and centralized backup.
How to Create a Network Link in GE
Creating a network link from the GE interface is a simple process, but you will need to make sure that your content (KML/KMZ) has been saved to the server you are linking to. Select Add à Network Link from the GE menu. Give your network link a name, and specify the link to your file on a server. The “Refresh” tab can be used to specify how frequently your data is refreshed. See the figures below for more information on created a network link through the GE interface.
The primary KML elements used to define a network link include <NetworkLink> and <Link>. <NetworkLink> is used to define the existence of a network link while <Link> combined with <href> specifies the location of the KML/KMZ file to load. This can be a local link or a link to a remote server. For instance, in the code example below, the <Link> element and <href> child element point to a dynamic Python CGI script (http://yourserver.com/cgi-bin/randomPlacemark.py) that will dynamically run when the network link is referenced. Other important elements include <refreshVisibility> which is used to specify the data update frequency, <name> which contains the descriptive name of your network link, and <description> which as its name implies refers to the description you give to the link.
In my opinion, the most compelling reason to use network link functionality is the ability to dynamically update the data source on the fly through the use of CGI scripting languages such as Python, Perl, Ruby, PHP, and others. In this case, each time the network link is accessed, a specific script is triggered which generates KML data streams to the network link. This provides just in time access to the latest data for your application. The process works as follows:
- Client (Google Earth) calls the server (KML/KMZ file)
- Server (KML/KMZ) contains a pointer to a CGI script
- CGI scripts runs and returns a KML stream (dynamic KML) containing the data for your application
This provides powerful functionality for generating dynamic KML content.
In the next post we’ll take a look at a specific example of how you can combine a Python script with network links to generate dynamic Google Earth content. Our upcoming course “Creating Dynamic Google Earth Applications” covers the topic of network links in great detail.
For more information on integrating ArcGIS and Google Earth please consider our “Integrating ArcGIS Desktop and Google Earth” virtual training course.