Someone pointed out that it would be nice to be able to alphabetically sort the features in KML so that people could more easily find them in Google Earth. This is a great idea, and I’ll be looking into a sorting method soon. In the meantime, I started investigating how to query the data in a manner similar to the way that we query GIS data. The basic idea is to query and/or sort features in Shape2Earth using their attributes, and then zoom to their location in Google Earth.
To do this, I have added an additional tab to the Shape2Earth form. It loads all of the attribute data of the shapefile into a data grid. Data is only loaded when requested in order to optimize performance for users who only want to convert data to KML.
Once selected, all of the attributes are loaded into the table. In this example, I have already loaded a shapefile of world volcanoes into Google Earth as a KML network link. Each feature in the table of contents in Google Earth has the name of the volcano, but they are not in alphabetical order.
With the attribute data from the KMLs companion shapefile loaded into Shape2Earth, I have a couple of options for finding a particular feature. I can sort the table based on any of the fields (see below) and then manually select the feature in the table that I would like to zoom to in Google Earth.
I can also search for attributes using a text field to enter values. I can look for specific values, or use a 'like' clause to match close values. In this example, I have entered 'helens' to query for Mount Saint Helens. I have one record that matches this query, and I can view it by itself by clicking 'View Selected'.
I can return to the rest of the table by clicking "Shop All". To zoom to my selected feature, I simple click on "Zoom to Selected", and then watch as Google Earth gracefully zooms to the item I have selected.
To make this querying capability as fluid and useful as possible, I have added an option that allows for Shape2Earth to always sit on top of Google Earth. This provides the ability to really smoothly navigate through Google Earth usinattributeribute data.
So far, it has worked fantastically for points and polygons the size of buildings. I'll have to add some geometric functions for it to work appropriately for large polygons. GE does not let you set the MapView coordinates that way that a typical GIS does. So I will need to mimic this using a center-point and distance.