A GEB reader recently asked us how to import geotagged photos into Google Earth. We are not looking at geotagging/geolocating which is the process of attaching a latitude and longitude to a photo. We are assuming this has already been done either by the capturing device, such as a smart phone, or by some other means after the image was captured. Geotags are typically stored in the image in a format known as EXIF.
As we have seen with Landsat imagery, Google Earth Pro can read geolocation information from files when they are used as image overlays. However, we found that neither Google Earth nor Google Earth Pro have built in functions for reading the EXIF data from photos. We found Picasa has functionality to create a KML file based on EXIF data but it uses Google Earth to do so and the latest version appears to be incompatible with the latest version of Google Earth and we were unable to get it to work.
So we thought it might be useful to have a JavaScript based way to do the job. We found this useful JavaScript library for reading EXIF data and some sample Python code in Google’s KML documentation.
This is the result:
NOTE May 3, 2023 The script Timothy wrote is no longer working, so it has been disabled.
Notes:
- You can select multiple files and a single KML containing all of them will be created.
- You may have to set your camera to include the location data in the photos, as it is often turned off by default for privacy reasons.
- The KML created does not include the photos themselves but instead has links to the photos.
- Move the downloaded KML file into the same folder as your photos before opening it in Google Earth.
- To share the collection with other people you can save it as a KMZ file from within Google Earth and it should create a single file that includes the photos inside it.
- The JavaScript works entirely within the browser so your photos are never uploaded to the internet.
- If you find bugs or have suggestions for improvements please let us know in the comments.
- The direction the photo was taken is not stored in EXIF data. You can, if you wish, adjust that later in Google Earth.
- We have ignored the altitude in the EXIF data and defaulted to 10m above ground level. You can adjust it later in Google Earth.