Rotating and Translating Placemarks, Polygons and Paths

February 8, 2016

The Google Earth placemarks and drawing tools assume that whatever you are marking or drawing is in a fixed geographical location. Although you can move individual placemarks or individual points on a polygon or path, you cannot move multiple items at once, or even move a whole polygon or path.

We recently got an email from one of the pilots of the Geico Skytypers Airshow Team. They plan their airshows in part with the aid of Google Earth and when they want to do a show at a new airport they have to recreate all the placemarks and paths again. So, they asked whether there is a way to move a group of placemarks and paths to a new location. We have recently been developing a JavaScript KML library for our own use and thought this would be a good way to test it. So we have created a small tool that allows you to take any set of placemarks, polygons and paths and move them to a new location. You can also, optionally, rotate them about a point.

To use it, simply create a placemark nameed ‘from’ near the objects you want to move. Then create a new placemark named ‘to’ where you want them all moved to. Then save them all, including the new placemarks a KML file. Upload it below and click ‘Translate’. It should download a new KML file with all your placemarks, paths and polygons moved to the new location. The way it works, is it calculates the distance and bearing from the ‘from’ placemark to each latitude and longitude pair in the KML file. It then calculates the same distance and bearing from the ‘to’ placemark and moves the latitude and longitude pair to that location. So everything is moved in relation to the ‘to’ and ‘from’ placemarks. This avoids the distortion you would expect if you simply add a fixed amount to the latitudes and longitudes.

Rotation is achieved via two possible mechanisms. The easiest is to simply type in the rotation angle below. Alternatively, create two paths labelled ‘from’ and ‘to’ with just two points each and include them in the KML file. The tool will work out the angle between the two and use that as the rotation angle. So, for example, if you want to move a set of placemarks from one airport to another while maintaining the alignment with the runway, you put the ‘from’ path along the runway of the airport you are moving from and the ‘to’ path along the runway of the airport you are moving to, and everything should line up. The point of rotation is the ‘to’ placemark.

Optionally rotate clockwise by:

Do not rely on the results – double check everything. We take no responsibility or liability, for any damages resulting from the use of this tool. It has not been tested very thoroughly and is not guaranteed to be accurate. Our KML parser is incomplete and may exclude some elements. It tries to translate more than just placemarks, paths and polygons, but some will not work perfectly. Image overlays, for example, do not work properly. The ‘Camera’ and ‘LookAt’ elements are translated but may not be quite right. The JavaScript works entirely in the browser so your KML is never uploaded to our server.

Create ‘from’ and ‘to’ placemarks.

Everything is moved relative to the ‘from’ and ‘to’ placemarks.

‘From’ and ‘to’ guidelines let you rotate and easily line up with geographic features.

Remember that the translation and rotation are still relative to the placemarks. The guidelines only determine the angle of rotation.

If you put the ‘from’ and ‘to’ placemarks in the same spot you can rotate around that point.

If you find any bugs, or have suggestions for further enhancements, please let us know in the comments.

See here for a variety of other JavaScript utilities we have made for working with KML.

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.

It’s a phenomenal program. I used it 20 times last year with excellent results. I am about to start my new season and I think that an upgrade to my OS has disabled the TRANSLATE button. Anyone have a fix for me. I think something is blocking that button from accessing the Java Script. I updated JS, emptied the cache…can’t think of anything else…ideas?

Phenomenal program, I used it 20 times last year. I am having a problem with the TRANSLATE button. I can select a KML file, but the TRANS button won’t go to the next step. I updated my Java Script, used Safari, Chrome, and Firefox. Emptied my cache…any ideas? Thank you in advance, Ken

I thought I might have found the issue, it worked twice, but now, not so much. It appears that when I leave a post, the TRANSLATE button becomes active…going to try this theory out, but it still doesn’t get at the root problem…

It appears as if this is the case. If I post something, the TRANSLATE button becomes active and it works like a charm. I can even hit the back button and translate another layout. If I close this window, then reopen, my posts are not visible until I post again. There has to be a simple switch in my firewall, or other add on that is not allowing me to TRANSLATE without posting. I’ve tried several things but am open to suggestions!! Thank you….Ken

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.