Splitting Google Earth Polygons and Paths

We maintain a map of the 3D areas in Google Earth. This is achieved with the help of GEB readers who send in KML outlines of new areas. However, we often receive outlines that are not ideal and need some manipulation before inserting into our KML file. We have created a number of scripts that help us combine various combinations of Polygons and Paths to deal with most situations. But, there are still some cases where manual intervention is required. Possibly the most tedious task is when a Polygon or Path needs to be split into two. In Google Earth, this requires duplicating the feature with copy/paste, and then deleting half the points in each copy. For features with a large number or points this can take a while.

So, we decided to make a simple tool that splits Polygons or Paths.

For best results, just save from Google Earth a single Polygon or Path that you wish to split as a KML file then upload it below. It should show the feature on the map. If there is more than one feature in the KML then click on its name in the left hand column. It should then highlight the vertices. If it is a Polygon, click on a vertex to split it at that point and convert it into a path. Click any point on a Path to split it into two Paths. Click ‘Save’ to download the result as a KML file.

 

 
If you submit KMLs of new 3D areas, please follow the guidelines found here. Essentially, the ideal format is a single Polygon for independent new areas, Paths for extensions, only covering the new areas and only on the outer edge.

[ Update: 2017-02-04 Updated the code to also handle MultiGeometries. ]

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.






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. Timothy…. do you perchance have a snippet of code that removes “redundant” lines – i.e. when someone submits a “raw” trail which has multiple backtracks and/or a bidirectional (down and back) trail which then has two lines over the same trail when you only need the one – (and perhaps separate linestrings for portions which vary by a defined amount like in alternate side paths)?

    • Timothy Whitehead says:

      I have code along those lines, but probably not quite in the right format you need. Can you send me a sample and describe what you would like to see as the output.

  2. Ricardo Borges says:

    Very useful, thank you!

    Unfortunately it doesn`t work with paths from Wikiloc and Trimble, since they export paths as placemarks. Please see info below.

    https://productforums.google.com/forum/#!topic/maps/cCINhM5qZcg;context-place=topicsearchin/maps/category$3Agoogle-earth%7Csort:relevance%7Cspell:false

  3. With the most recent stereophotogrammetry update, there is now a huge area spanning from the north of Delaware to the south-west of Massachusetts. This is a huge issue for the sorted by countries layer and I was wondering if it would be possible to automatically separate polygons based on region. If it is possible but requires some manual intervention, I would volunteer to help out if necessary. If it cannot be done automatically, but you do want it to be done, I could also help to do it manually.

    • Timothy Whitehead says:

      Until now, I have put areas that span state boundaries in the state that either has the largest area or the largest city in the area. In this case I will probably put it in New York, but note in the area name the other states involved. I’ll give some thought as to whether breaking them up by state would be a good idea. It would make it harder to manage going forward.



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.