Writing KML with Basic Styling

Liz Sanderson
Liz Sanderson
  • Updated

Introduction

The KML format supports tags that define the style and symbology of the features within a dataset. In FME, these tags can be set using KML-specific transformers, including the KMLStyler.

Video

Convert data from multiple sources (in this case, MapInfo TAB and MIF/MID) to KML for loading in Google Earth and other earth browsers. You'll see how to automatically set tags to define the style and symbology, set up the KML tree, and control the schema / attributes. This video was recorded with an older version of FME. The interface will be different but the concepts are the same.

Step-by-step Instructions

Part 1: Style Polygons

1. Open FME Workbench

In a blank workspace, add a MapInfo TAB (MITAB) reader, browse to the city_parks.tab file that is included in the downloads. Click OK to add the reader.

tabreader.jpg

2. Rename Attributes

When we view the attribute names in Google Earth, we don’t want any underscores or any other data-specific naming conventions. Add an AttributeRenamer transformer to the canvas. Select name_alt as the Input Attribute and then type “alt name” as the Output Attribute.

3. Set KML Properties

We can also control how the attributes appear in the navigation tree in Google Earth, as well as the pop-up description balloons when you click on a feature. Add a KMLPropertySetter to the canvas and connect it to the AttributeRenamer. In the parameters, set up the following:

  • Name: name
  • Summary: Park
  • Attribute Table Title: Park Names

kmlpropsetter-parks.jpg

4. Style Polygons

We want to style the park polygons with a black border and a green fill, to do this we will use the KMLStyler. Add a KMLStyler to the canvas and connect it to the KMLPropertySetter. For Color, select black (0,0,0), then for Fill Color, select lime green (0,255,0), or any other green. Finally, change the Fill Opacity to 0.7.

kmlstyler-parks.jpg

5. Write to KML

With the properties and style set, we can now write to KML. Add a Google KML writer to the canvas. Browse to a location to save the file and name the dataset ParksAndNests.kml. Set the Feature Type Definition to Automatic.

parksandnestwriter.jpg

In the Feature Type dialog, set the Feature Type Name to Parks and click OK. Connect the Writer feature type to the KML Styler.

Part 2: Style Points

1. Add a MapInfo MIF/MID Reader

In the same workspace as Part 1, add a MapInfo MIF/MID reader to the canvas. Browse to the BirdNestPoints.mif file and then set the Coord. System to TX83-CF. Click OK to add the reader.

As of FME 2025.2, the Coordinate System parameter is now configured within the Parameters dialog of each reader/writer format. For more information, including details about the change and affected transformers, please see Coordinate System Parameter Location Change.

mifreader.jpg

2. Set KML Properties

Now, to set the KML properties for the navigation tree and description balloon. Add a KMLPropertySetter to the canvas and connect it to the BirdNestPoints reader feature type. In the parameters, set up the following:

  • Name: Nest_ID
  • Summary: Bird nest in the city of InteropolisPark
  • Attribute Table Title: Bird Nest

kmlpropsetter-nests.jpg

3. Style Points

Point features are locations of interest that have a specific point, but not a defined size, such as mountain peaks or historical markers. In KML, point features are assigned an icon as a map symbol. FME includes a set of built-in icons specifically designed for KML format translations and viewing. Add a KMLStyler to the canvas and connect it to the KMLPropertySetter_2. In the parameters, expand the Icon, then click on the ellipsis next to Name. You can select whichever icon you wish, but we will be using C2. We can leave the rest of the parameters as the default.

kmlstyler-nests.jpg

4. Write to KML

With the properties and style set, we can now add to our KML file. On the top menu bar, select Writers > Add Feature Type to add our Nests feature type to the ParksAndNests.kml file.

addfeaturetype.jpg

In the Feature Type dialog, set the Feature Type Name to BirdNests and click OK. Connect the BirdNests writer feature type to the KMLStyler_2.

birdnestsfeaturetype.jpg

5. Run the Workspace

Save and run the workspace. View the output in Google Earth, you should now have both the parks and the bird nests in the same KML file.

nestsparksoutput.jpg

Data Attribution

The data used in this article originates from open data made available by the City of Austin, Texas. It contains data licensed under the Public Domain Dedication License, as provided by the City of Austin.

Was this article helpful?

We're sorry to hear that.

Please tell us why.

As of January 14th, 2026, comments on knowledge base articles have been closed. To make sure questions don’t get missed and to enable more community support, we’ve moved discussions to the FME Community. If you have a question or a comment about this article, please create a new post or create a support ticket.