Dynamic Google Earth Applications
with Network Links
Eric
Pimpler
President,
GeoSpatial Training Services, LLC
Our “Google Maps For Your Apps ”
and “Integrating ArcGIS
Data with Google Earth ” courses provide detailed information about
Google Maps and Google Earth. Each
course provides detailed audio and hard-copy lecture materials, visual
demonstrations, and exercises designed to supplement the materials presented in
our lectures. In addition, you can now purchase these courses as a
bundle. Click the links
provided above for more information.
Introduction
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.

Advantages
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.


KML
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.

Dynamic Scripting
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:
This provides powerful
functionality for generating dynamic KML content.
Examples
See some network link
examples at Google
Earth Hacks and Google
Earth Blog.
More Information
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.
Author Information
Mr. Pimpler is the owner of Geospatial
Training Services, LLC, a provider of virtual and instructor led GIS training
opportunities and the author of its popular virtual training course “Google
Maps For Your Apps!” and the recently released "Integrating ArcGIS Data with Google Earth" For more information
regarding training opportunities provided by GeoSpatial
Training Services, please visit our website at http://www.geospatialtraining.com.
This
article copyright (c) 2007 Eric Pimpler, GeoSpatial Training Services, LLC - http://www.geospatialtraining.com