Export KML/KMZ (Keyhole Markup Language)

CityEngine 2022.1    |    |  

Keyhole Markup Language (KML) is an XML-based exchange format used to describe GIS features on the globe. It supports points, lines, and polygons and can reference 3D models through COLLADA. It is used to produce data for ArcGIS Earth.

KMZ is a compressed version of KML in which all referenced COLLADA and texture files are contained in one zipped file.

Export options

In addition to the general export options, the following options are available for KMZ/KML export:

OptionDescription

Altitude Mode

Controls which altitude tags are written to the .kml and .kmz files:

  • clampToGround—Aligns the object to the ground, and altitude is ignored.
  • absolute—Ignores the ground elevation.
    Note:

    For absolute, the ground elevation and the altitude must coincide precisely.

Write Compressed Files

When set, the written .kml file is put into a .kmz archive file along with the other necessary files such as .dae files and texture images.

Heading Correction

ArcGlobe, Google Earth, and other earth browsers interpret the COLLADA .dae file content differently. For Google Earth, the Heading Correction switch must be turned on for correct results.

Placemark Locations

  • Exact spatial references per model—Unprojects placemark locations per shape. This is recommended for unconnected objects (such as buildings) for bigger areas.
  • Optimized Model placement—Optimizes placemark locations to ensure correct relative positions (unproject only in the lead shape, other shapes are referenced relatively). This is recommended for connected objects (such as streets) over small areas.
Note:

Use the KML export presets Google Earth Compatibility, ArcGlobe Compatibility, or SketchUp Compatibility to set recommended options for these programs.

CityEngine KML output

When saving some selected objects by the name MyPlacemarks, the export process writes the MyPlacemarks.kml file. Next to it, there is a folder named MyPlacemarks.kml-files containing the associated .dae file and textures.

Example KML file output

The following is sample code for KML output:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"     xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
    <Document>
        <name>MyPlacemarks</name>
        <Folder>
            <Placemark>
                <name>aPlacemark</name>
                <Model>
                    <altitudeMode>clampToGround</altitudeMode>
                    <Location>
                        <longitude>-75.17193217718045</longitude>
                        <latitude>39.95381194059072</latitude>
                        <altitude>10.82616576552391</altitude>
                    </Location>
                    <Orientation>
                        <heading>0.0</heading>
                        <tilt>0.0</tilt>
                        <roll>0.0</roll>
                    </Orientation>
                    <Scale>
                        <x>1.0</x>
                        <y>1.0</y>
                        <z>1.0</z>
                    </Scale>
                    <Link>
                        <href>MyPlacemarks.kml-files/aPlacemark.dae</href>
                    </Link>
                </Model>
            </Placemark>
            <Placemark>
                <name>anotherPlacemark</name>
                ...
            </Placemark>
            ...
        </Folder>
    <Document>
</kml>


In this topic
  1. Export options