My Google Map Blog

Archive for February 8th, 2016


Rotating and Translating Placemarks, Polygons and Paths

by Timothy Whitehead on Feb.08, 2016, 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

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.

The post Rotating and Translating Placemarks, Polygons and Paths 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...