Labelling Polygons in Google Earth

We were recently asked by a GEB reader whether or not it is possible to add labels to paths and polygons. The ability to add labels to paths was added to KML with version 6.1 of Google Earth. Unfortunately, it cannot be done within Google Earth but requires editing the KML file. You need to identify the style element for the lines you want labels for, and add <gx:labelVisibility> in a <LineStyle>. See the KML Reference for more.

For polygons, however, there is no way to tell Google Earth to display the label. The only solution is to create a separate placemark for each polygon with the name. This can be quite tedious for large datasets, so we thought it might be useful to have a utility to do it automatically.

The utility below simply goes through a KML file and for every polygon, creates a new placemark in the centre with the same name as the polygon.

Our KML parser is still in development so it is not guaranteed to keep all elements in the KML file. Let us know in the comments if you find any bugs or have suggestions for improvements.

We tested it on our map of 3D imagery.

We previously wrote a JavaScript utility to put numbered labels on the points of polygons.

About Timothy Whitehead

Timothy has been using Google Earth since 2004 when it was still called Keyhole before it was renamed Google Earth in 2005 and has been a huge fan ever since. He is a programmer working for Red Wing Aerobatx and lives in Cape Town, South Africa.


  1. Unfortunately, the KML parser did not work for me. No labels created.

  2. My file too – looks the same as before I ‘converted’ it. FYI my kml was created from ArcCatalog’s ‘Map to KML’ tool.

  3. The converter worked for me!

Leave a Reply