KML Tool For Visualizing Google Earth Cameras, and More

Mick West

Administrator
Staff member
Metabunk 2019-03-27 09-21-00.jpg

https://www.metabunk.org/KMLTool/

The Metabunk KML tool takes one KML/KMZ file containing a Google Earth camera (and optionally some other stuff) and spits out a KMZ file that contains a variety of useful stuff. The initial intent of the tool was simply to show the view volume in Google Earth, to help understand what the viewer was looking at. This rapidly evolved as I just kept adding things, like various plane (eye level, horizon), and lines of sights. It continues to evolve and contains a few experimental outputs that will change over time. More will be added.

What is a Google Earth Camera? It's actually a Google Earth "Photo Overlay", which you get with "Add Photo"
Metabunk 2019-03-27 09-18-30.jpg

The purpose of adding a photo is to match up a photo in 3D, so you can duplicate the view in Google Earth. For example, the top image in this post is showing the camera that first this photo:
Metabunk 2019-03-27 09-22-06.jpg
When to match this, you first find where the photo was taken from, and then position the camera in Google Earth there, pointing roughly in the right direction. You then "Add Photo" and you get a box like:
Metabunk 2019-03-27 09-24-00.jpg

You'd normally then adjust the transparency, and adjust the heading, tilt, and FOV until the photo matches the Google Earth view. For the KML tool you need to set the height to "Above sea level" (sometimes you will have to toggle this to get it to stick).
Metabunk 2019-03-27 09-27-50.jpg

This gives you a "Place" with a camera icon, which you can then save, and load into the KML tool.
Metabunk 2019-03-27 09-30-03.jpg

So just load it into the KML too, and it will spit out a KMZ file, which you can then load into Google Earth.

You can do this with just a single photo overlay (camera), but you get more options if you create a folder, put the camera inside this folder, and then add some placemarks. Like here, where I've added a placemark on the top of each peak in the view
Metabunk 2019-03-27 09-39-22.jpg

And put them in a folder with the photo overlay (camera)

Metabunk 2019-03-27 09-38-11.jpg

This, in turn, spits out a folder of fun and useful stuff, some of which is switched off by default, and all is subject to change.
Metabunk 2019-03-27 09-41-01.jpg

You can turn these on to see what they are, and expand the sub folders for more options. But briefly:

  • Frustum - A wireframe outline of the 3D field of view. The size of this is set at 100KM by default, or just past the furthest placemark (the best way of setting it)Metabunk 2019-03-27 10-01-28.jpg
  • End Image - The photo, put at the end of the FrustumMetabunk 2019-03-27 10-04-46.jpg
  • Horizontal Planes
    • Frustum Center Plane - half way down the frustum, the "line of sight" of the camera centerline.
    • Eye Level - A horizontal plane starting at the camera (horizontal meaning parallel to the Earth's surface below the camera)
    • Horizon Plane - a plane from the camera, just skimming the horizon. This should represent the "geometric hidden." In reality, the atmosphere usually raises things up a bit via refraction, so you will see more. I plan on adding a curved surface that would be the refracted version of this.Metabunk 2019-03-27 10-05-42.jpg
  • Lines Through Points - Lines from the camera, though each placemark, and on to the end of the frustum.Metabunk 2019-03-27 10-07-02.jpg
  • Images at Points - the photo, positioned at each individual placemark. Useful to see how well things fitMetabunk 2019-03-27 10-07-52.jpg
  • Planes Through Points - frustum planes that pass through each point. Usful so you can see where the top of one peak slices though a different mountain.
  • Point Drops - Shows the "Flat Earth" position of each placemark, and a line showing how far it is below this position on the globe. Metabunk 2019-03-27 10-09-59.jpg
  • Point Drops on Rear Image - collects them all on the back image, to show where they would be in the photo (ignoring refraction)Metabunk 2019-03-27 10-12-42.jpg
  • Source Data - a copy of the original folder (so don't leave any personal data in there if you plan on sharing)
  • AB Tour - (experimental) A tour which will raise and lower the camera while zoomed in on the distant scene.
    Source: https://www.youtube.com/watch?v=QxjUgCEvGwk
  • Ocean Surface - A blue grid at 0m altitude. This was added as Google Earth does not render the surface of the ocean very well sometimes. So adding this grid means there's a perfect water surface showing where the horizon is. Usuful for the AB Tour (when it works).


It very much a work in progress, but I'm releasing it now as it might be useful to some people.
 
Last edited:
Some technical notes.

The complicated stuff here is the translations between various coordinate systems. There are three that I use: LLA, ECEF, and ENU

  • LLA - (Latitude, Longitude, Altitude) is what Google Earth uses in the KML. It's two angles, and an altitude above the surface, like a "GPS position". This is complicated by the oblateness of the Earth, which leads us to two variants of LLA
    • Geocentric LLA (LLAC)- Where the latitude is the angle between the point, the center of the earth, and the equator.
    • Geodetic LLA (LLAG) - Where the latitude is the angle between the surface normal (a line perpendicular to the surface) and the plane of the equator.
  • ECEF - (Earth Centered Earth Fixed) a 3D coordinate system where each coordinate is a distance from the center of the Earth along one of three axes. Shown in blue in the diagram below.
  • ENU - (East, North, Up) a local coordinate system relative to one point on the earth's surface. Essentially the coordinate system of a 3D model (like a DAE file) placed at that point.



Metabunk 2019-03-27 10-19-36.jpg

Google Earth uses Geodetic LLA, but you'll often find code that uses Geocentric LLA because it's simpler (and because people don't understand the difference). Currently, my code is using some geocentric calculations which I'll change to geodetic later. Converting ECEF to geodetic LLA is non-trivial, but so long as it's symmetrical the differences will be negligible.

ENU is used in generating 3D models at particular locations (the "end image" is a 3D model, and there's a test cube which will eventually be a flying UFO), and as an intermediate step in converting camera tilt and heading into ECEF. Here again, there may be some geocentric/geodetic overlap.
 
Last edited:
Updated with:
  • Filename now reflects original filename, with _MBK added at the end
  • Ocean surface off by default
  • New folder "FOV Adjustment Hacks" to change the field of view
Metabunk 2019-03-29 06-06-47.jpg

170 is fun:
Metabunk 2019-03-29 06-08-14.jpg
 
Added a "side view" folder:
Metabunk 2019-03-29 11-16-42.jpg
Metabunk 2019-03-29 11-15-33.jpg

The idea was to position the camera sufficiently far away that it would resemble an orthographic projection. Unfortunately, GE stops rendering the mountains at some distance, or for some reason. Like here the sisters (near the camera on the left) do not show up.

The best way to screenshot it is to go into "Get Info" for the side view angle you want and then make the border transparent.
 
Back
Top