Export Drawing - KML, KMZ

KML is an XML-based format originally used for "annotations" in Google Earth displays. KMZ is exactly the same format compressed using "zip" compression with a three-letter file name extension of .kmz. KML can be used for showing points or other vector objects from a GIS format drawing as well as for images. Manifold includes the ability to export a drawing or image as a Google Earth KML or KMZ file. It's a quick and convenient way of publishing your GIS data for use with Google Earth or other applications that can use KML, such as NASA World Wind, Microsoft Virtual Earth applications and others.


Manifold can also import KML and KMZ. See the Import Drawing - KML, KMZ topic for additional import information.


KML and KMZ support Latitude / Longitude projection using the WGS 84 Auto datum only. Drawings to be exported to KML or KMZ can be in any projection and will be re-projected on the fly into Latitude / Longitude during export; however, to avoid a potentially slow re-projection process it is wise to explicitly re-project drawings into Latitude / Longitude using the WGS 84 Auto datum before export. This not only avoids a slow export, it also provides an opportunity to catch errors before export if the re-projection results in a strange display as might happen if the initial projection was not correctly assigned, say, after importing projected data from some format that does not store projection information.


Unlike drawings, images must be already in Latitude / Longitude projection using the WGS 84 Auto datum to be exported to KML or KMZ.


KML format as produced for Google Earth is a simplified format that records only the geographic locations and shapes of objects and up to two fields per object, a Name field and a Description field. It does not allow storage of more sophisticated database information. If Manifold fields other than text fields are used for the Name and Description, Manifold will capture the data as text for storage into the KML file. Missing or blank field values will be ignored when a drawing or map is exported to KML.


Drawings exported to KML or KMZ can contain points, lines and areas. Areas will be rendered using partial opacity while points and lines will be rendered at full opacity. To use transparency with points and lines, export a map which has the drawing as a layer with layer opacity set to the desired value; however, areas are always rendered using partial opacity with that partial opacity being modified by whatever layer opacity setting has been used in a map. That is, areas can be made even more transparent but can not be made fully opaque.


To export a drawing to KML format:


1. Open the drawing in a drawing window.

2. Choose File - Export - Drawing from the main menu.

3. In the Export dialog choose KML Files in the Save as type box and specify a filename to use. Press Save.

4. In the Export KML File dialog if desired specify the columns in the drawing's table that will be used for Name and Description fields in the KML file.

5. If you would like to extrude points, lines or areas into 3D shapes, specify a column in the drawing's table that will be used for the Height to give the height in meters. By default this is meters above sea level. Check the Relative heights box to extrude the object to that height in meters above the terrain elevation.

6. Press OK.


Exporting Maps


To export all drawings in a map to KML or KMZ, follow the above procedure with the map. Individual map layers are exported as separate folders in the KML. Note that all drawings in the map should have columns with the same names if such column names are specified for Name, Description or Height.


KML or KMZ exported from maps will respect layer transparency (opacity). That is, if a layer has had partial transparency set using the Opacity setting for a layer, upon export to KML the objects displayed in Google Earth will also be partially transparent. This can be used to create outstanding effects.


When a map is exported, folders in the resultant KML for drawings that have more than ten objects will be closed by default. This prevents the folder display in Google Earth from growing overly large by default.


Creating KMZ Files


The Manifold KML exporter will create .kmz files if the extension for the filename given is .kmz. KMZ format is simply a "zipped" KML file.


About the WGS 84 Auto Datum


This is a special datum based on the standard WGS84 datum that has automatic fine adjustment to account for different image servers or applications that use WGS84. When projection a component for ultimate export to KML or KMZ, use the WGS 84 Auto datum.


Extruding 3D Shapes


Specifying a Height column that contains a value for each object in the drawing to use as an altitude will extrude the object into a 3D shape of that height in meters above sea level. Checking the Relative heights box (unchecked by default) will convert that height to a relative height above ground level in that location. It is usually a good idea to check the Relative heights box.




The above illustration shows gerrymandered congressional districts as areas that were exported to Google Earth using a Height column that gave values of tens of thousands of meters. The districts are very large, so to have them be obviously higher than the surrounding terrain requires large heights. The areas were colored using the same colors for both area background and also area border line. Google Earth shows the border line in opaque rendering even as the main area is partially opaque. This is a pleasant effect in that it results in nice highlights for the "walls" of the extruded shape.




For the above illustration black color was used for area border color. Choosing a good color combination for area color and area border line color is an important part of the art of making appealing Google Earth displays.


Coordinate Accuracy


Exporting a drawing to a KML file preserves at least 8 decimal digits in coordinate values and trims trailing zeros. This typically results in a file that is smaller yet retaining full precision for coordinates.



Export to Google KML and KMZ is an experimental capability due to the constantly evolving and poorly documented nature of Google Earth itself. Google Earth appears to have been designed mainly for visual overview by consumers and not as a rigorous GIS application for use by professionals requiring full precision. Of special importance is that essential documentation on the use of projections and the data composition methods used to prepare raster data for display by Google's mapping services is absolutely lacking. .


Therefore, while Manifold export to KML and KMZ makes it easy to create striking visual displays with very little effort, users should not expect that at very detailed zoom levels the objects exported by Manifold will line up perfectly with images generated by Google Earth. The Manifold objects will be placed to absolute precision given the limits of whatever data source has provided those objects, but Google may not always be in agreement with data sources such as USGS, the Census Bureau or US military data sources.


Because Google provides little information on how it cobbles up a particular visual display, it is not possible to diagnose why a particular Google image sometimes does not match commonly accepted, authoritative sources of GIS data that are written to KML or KMZ using the information provided by Google.


Given the relative newness of Google Earth and the focus on consumer viewing, it is possible that it is simply not a matter of concern for the application that some imagery might have shifts of a few meters or even a few dozen meters as compared to GIS data from other sources. After all, since the announced goal of the application is consumer "mash ups" showing things like the locations of one's favorite beer halls it is more important that points of interest may be declared in a simple and easy-to-apply format than it that such points appear with accuracy better than a few meters. One suspects that tight integration with the many sources of professional GIS data might be such a low priority matter that Google itself may not at the present time have investigated all details necessary to resolve data compatibility issues as can be done within dedicated GIS applications.


Given Google's often-stated commitment to supporting "open" development by the Google user community we expect Google Earth to evolve and be improved in many ways, including support for closer matches between user-supplied data and Google Earth displays when using KML and KMZ. Should Google Earth or KML and KMZ format change before the next edition of Manifold becomes available, it is possible that new versions of export to KML and KMZ format might become available as add-ins to Manifold System.


See Also


A Flashy Demo - Web Queries and KML

Exporting KML to Google Earth

Fun with Google Earth

Linked Images from Google Servers

Export Image - KML, KMZ

Import Drawing - KML, KMZ