• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Google Earth Blog

The amazing things about Google Earth

  • Home
  • About
  • Basics
  • Links
  • Tips
  • 3D Models
  • Sightseeing
  • Videos

Labelling Polygons in Google Earth

February 11, 2016

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.

  • More Posts(754)

Filed Under: Site News Tagged With: KML javascript utilities

Reader Interactions






PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.

Comments

  1. John says

    October 11, 2016 at 5:31 pm

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

  2. Karl says

    November 25, 2016 at 8:18 am

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

  3. Scott Altman says

    December 5, 2016 at 11:19 pm

    The converter worked for me!



PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.

Primary Sidebar




Categories

  • 3D Models (792)
  • Applications (708)
  • Business (288)
  • Environment (353)
  • Flying (208)
  • GE Plugin (282)
  • Google Earth News (1,764)
  • Google Earth Tips (592)
  • GPS (136)
  • Navigation (227)
  • Network Links (214)
  • Sailing (121)
  • Science (499)
  • Sightseeing (1,903)
  • Site News (587)
  • Sky (67)
  • Sports (154)
  • Street View (50)
  • Tours (117)
  • Video (421)
  • Weather (180)

Google Earth Satellites

Copyright 2005-© 2026 Frank Taylor. All Rights Reserved.

This blog and its author are not an official source of information from Google that produces and owns Google Earth Google and Google Earth are trademarks of Google Inc.. All image screenshots from Google Earth are Copyright Google. All other trademarks appearing here are the trademarks of their respective owners.

Go to mobile version