My Google Map Blog

Archive for October 7th, 2015


KML Polygon merger

by Timothy Whitehead on Oct.07, 2015, under 3D Models, Argentina, Australia, Brazil, California, Denmark, England, Germany, Google Earth News, Google Earth Tips, Google Sky, Google maps, Hawaii, Indonesia, Ireland, Italy, Japan, Kenya, Mexico, Natural Landmarks, Netherlands, Sightseeing, Street Views, USA

We have recently got a bit behind on updating our 3D imagery KML file. Part of the reason for this is the complexity of dealing with new areas that are extensions of already existing imagery.


Columbus, Ohio, got expanded 3D imagery (2). What you see above is what we want to appear in the timeline.


For the ‘Sorted by country’ section, we want to combine the new outline with the old outline, removing the shared border.

We already have the outline of the old extent of the 3D imagery (region 1) and we need two new outlines, one of just the newly covered area (region 2) that we use in the timeline and one showing the total area now covered that is used for the ‘Sorted by country’ section. So we want two new Polygons, one using segments 3 and 4 and another using segments 3 and 5.

It is possible to draw one of the new Polygons by starting with the existing polygon (1) and deleting the points in either segment 4 or 5 and then drawing segment 3. However, it still means that at least one segment of an outline needs to be redrawn. What would be ideal is to take a segment of the already existing outline and combine it with segments of the newly covered area outline. However, Google Earth has no easy way to do this. So we have written a bit of JavaScript to accomplish the task and we thought that it might be something that other people who work with KML regions might find useful, so we decided to share it.

To use our merger utility, first make sure you have two Polygon outlines that share a common border. Remove all points from the common border except the two at the ends of the shared border for each Polygon. Save the two polygons either in two separate KML files or a single KML file. Upload them below, then click the ‘Download merged Polygon’ button. Open the downloaded file in Google Earth.

It has not yet been tested very thoroughly so if you find any bugs please let us know in the comments. One problem that we encountered is that Google Earth Polygons may go clockwise or counter clockwise, so when combining two polygons by simply concatenating the list of points, it is possible to get a figure 8. We have tried to check for this and automatically correct it.

The post KML Polygon merger appeared first on Google Earth Blog.

Comments Off :, , more...


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...