Archive for February, 2009

I wanted to mention Richard Marsden’s new Geoweb Guru site. Geoweb Guru provides news and feature articles about the geospatial web. All levels from user to developer are covered, as are all online mapping technologies.

The Geoweb Guru also includes a series of discussion forums for members to exchange information, tips, and to ask questions. On-topic press releases and site recommendations can also be posted to the forums.

Reasons for Migrating ArcGIS Data to Google Earth
There are many reasons why you may want to visualize your existing ArcGIS data in a Google Earth viewer. Perhaps you simply like the convenience of using the built in base maps and aerial photography provided by Google Earth. Other reasons include the ease of use and familiarity your users already have with the product or perhaps you would like to reach a wider audience for your data products. This can easily be done by placing your Google Earth format files on a publicly accessible web site and allowing Google to include them in search results. Because all your data for a particular Google Earth project can be contained within a single file it is also easy to distribute to many users. Finally, many users like the enhanced data visualization that can be accomplished with Google Earth.

How Google Earth Displays Geographic DataIn this section of the course we will cover some basic KML concepts including the structure of a KML document, and the primary elements used to represent basic geographic features including points, lines, and polygons. We’ll also discover how to drape raster images across the Google Earth terrain and add legends to the display.

Advanced Google Earth Functions
In the Advanced Google Earth functions section of the course you will learn how to add and display geographic data that has a time component, use Google Earth when you’re not connected to the Internet, and finally we’ll take a look at the use of Network Links for dynamically streaming data updates tot he Google Earth viewer.

ArcGIS Desktop Translation Tools for Google EarthThe release of ArcGIS 9.3 saw the introduction of two geoprocessing tools that you can use to export individual layers as well as entire data frames to Google Earth format. These tools include “Layer to KML” which is used to export a single layer to Google Earth, and “Map to KML” which can be used to export all the visible layers in your data frame to Google Earth in either vector or raster format.

Third Party Tools for Translating ArcGIS Data to Google Earth
In the final section of this course we will examine two third-party extensions for converting ArcGIS data to Google Earth: Arc2Earth and Export to KML.

In addition, this course contains 6 exercises designed to re-inforce the concepts that you learn in lecture.

In this post we’ll continue our discussion of the ProgressbarControl Google Maps Utility class for enhancing your users’ experience during long running operations. This time we’ll examine the ProgressbarControl in more detail by reviewing a sample application.

Click here to see the demonstration and click the ‘Add Destroyed Homes’ button to add the markers to the map and watch the ProgressbarControl update as the markers are added. We’ll discuss the code used to create the ProgressbarControl below the image. You can view the code used to generate this simple demonstration by right clicking the web page and selecting View Page Source.

We will be loading the contents of an xml file containing approximately 200 residences destroyed in the San Diego Witch Fire. Each address in the file is loaded as a marker on the map. Because this is a large number of markers to add to a map it makes sense to use a ProgressbarControl that updates your user with the current status of the operation.

The initialize( ) function, as seen below, creates the basic structure of the map including map types and controls and at the end of this function makes a call to the loadFiresIntoMemory() function. This function opens the WitchFireResidenceDestroyed.xml file, loops through each record creating a marker for each address, and finally placing the marker into an array variable called ‘batch’. We will use the ‘batch’ variable later in our code to access each marker and add it to the map. All of this takes place as the map initially loads.

We can get away with loading the markers into memory because there are only 230 rows in the file, but this would not be a good idea if you have a really large dataset due to the performance hit of loading a large number of records.

Before we can access the ProgressbarControl we need to reference the progressbarcontrol.js file as seen below. This is done near the top of the file.

Now that we have a reference to progressbarcontrol.js we can create a new instance of ProgressbarControl. We add the following line of code to the initialize() function just below the call to loadFiresIntoMemory().

The initialize function should appear as follows:

Toward the bottom of the file you will see a button called ‘Add Destroyed Homes’. The ‘onclick’ event for this button will call a JavaScript function called ‘loadProgressBar()’. We are going to create this function next.

Next, we create the loadProgressBar() function that will be called when the ‘Add Destroyed Homes’ button is clicked.

Inside the loadProgressBar() function we initialize the ProgressbarControl using the start() method as seen above. The ProgressbarControl.start() method is used to display the progress bar on the map. In addition, we pass in a numeric value that defines the maximum value for the bar. In this case we are getting the size of our array using the length property. Remember that the ‘batch’ variable is an array containing GMarkers for each address in the xml file.

Next, we use the array.length method again to set a variable called ‘maxNum’ which will be used as a counter in a function we will create later.

Finally, we call the setTimeout() JavaScript function. This function is used to set a timer. Since the browser will not update the screen unless it has time to do so, we use setTimeout with a 1 millisecond delay in between each update. The setTimeout() function also accepts a function reference which will be called after the delay. In this case, the addMarkers() function will be called after the delay. We’ll discuss this function next.

Near the top of addMarkers() we called the ProgressbarControl.updateLoader() method which will update the progress of the control by a value of 1. Next, we pull the next GMarker out of the ‘batch’ array and add it to the map with GMap2.addOverlay. Finally, we check the value of ‘num’ to see if it is less than ‘maxNum’. Remember that ‘maxNum’ is set to the total number of GMarker objects loaded in the ‘batch’ array. This number should be 230. The ‘num’ value gets updated each time the ‘addMarkers()’ function is called until it is less than or equal to ‘maxNum’.