Tutorial: Getting Started with KML

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2020.0


KML stands for Keyhole Markup Langauge. It is an XML-based format (or language if you prefer) intended to store data for use within Google Earth and Google Maps applications.

KMZ is an alternative form for a KML format dataset. A KMZ dataset is simply a KML dataset compressed by a ZIP type program and renamed with a new file extension.



Feature Types and Datasets

KML is a file-based dataset, meaning that each KML file is counted as an FME dataset. Each file can contain "Folder id" section representing FME feature types.

For example, if the KML dataset name is planning and the feature type name is ROADS, the output would be a KML file called planning.kml containing a section beginning:

<Folder id="kml_ft_ROADS">


KML and Coordinate Systems

KML store coordinates as latitude and longitude values based on the WGS84 datum. This is the only coordinate system that KML supports. The FME equivalent coordinate systems are LL84 and EPSG:4326

Data sent to the KML writer must be tagged with a coordinate system, either from within the source data or using the CoordinateSystemSetter transformer. Then FME will automatically convert the data to LL84. When the data is untagged, and FME is unable to detect the source coordinate system, the translation will be terminated with an error.


KML Basics

Reading KML | KML to MapInfo TAB

Read and translate KML data, in this basic KML to MapInfo TAB translation.


Writing KML with Basic Styling

With the KMLStyler, perform basic styling of polygons and points. Basic KML properties are also set in this MapInfo TAB to KML translation.


Setting KML Regions and Display Criteria

This basic MapInfo TAB to KML translation involves renaming attributes and setting KML properties, including display criteria. The output, viewed in Google Earth, displays KML styling and basic balloons.


Basic 3D KML

Create basic 3D KML, by adding Z values to features and setting KML geometry properties, in this Geodatabase to KML translation.


KML Style Range & Display Order

Style KML using attributes, including unique styles by feature, and set the display order of features. The styling in this example includes classifying features into color ranges and extruding 3D features.

Updating KML Balloon Contents & Removing "Directions"

This example demonstrates how to remove "Directions" from KML Balloons, as well as use HTML to set the KML balloon content, in this case, URL links and images, such as pngs, jpegs, and tiffs.

Raster Handling in KML

FME can write georeferenced raster features directly to a KML (or KMZ) dataset. FME is also able to write a combination of vector and raster features to the same output file. 

KML Time Functions

To allow temporal mapping, all feature written to the KML format can be assigned a number of time-related attributes. In this example, the KMLTimeSetter is used to relate features to a single timestamp (i.e. this feature relates to time X).

How to Expose Feature Attributes from KML Tags or HTML Tables

In Google Earth, attributes are visible in the KML description balloon. This tutorial will show you two different methods of exposing those attributes based on how your data is structured. 

Using Google's Chart API to Create Charts from a CSV and Shapefile

Learn how to create KML charts with Google's Chart API from CSV and shapefile that can be viewed with Google Earth.

Creating a KML ScreenOverlay or Watermark

FME KML Watermarks provide users with a simple way to brand their KML. KML ScreenOverlay allows users to have more control over the position of their ScreenOverlay images. This article will cover how to create both a Watermark and a ScreenOverlay element at a position other than 0,0.

Label Google Earth Polygons

In addition to labeling points in KML, it is possible to label other geometries, such as polygons. To draw an icon and label in Google Earth, a point and a Placemark are necessary. 

Highlight KML Icons & Labels

Using KML StyleMap elements, learn how to create labels and icons with the highlight on hover functionality.

Creating KML Folders By Feature Type Fanout

This article describes what KML folders are and how to create them using the simpler method of feature type fanout. 

Creating KML Folders Through KML IDs

This article walks through how to create folders using KML IDs, which is a more complex method instead of feature type fanout but is fully customizable. 

How to use Google Earth to Georeference / Geocode KML files

Normally when writing to Google Earth KML files, FME users will write out locations as points. However, if you do not have location data, but only addresses, you will need to use a geocoding service to generate lat/long points.

Optimizing Large Datasets for KML and Google Earth

Splitting large datasets into smaller pieces is useful for displaying data in Google Earth. A single workspace creates both the KML Network link file and the tiled KML datasets. 

Earthquake KML Streaming Example

This example walks users through how to easily stream data using the sample dataset in FME Server. 

Was this article helpful?



Please sign in to leave a comment.