Importing geotagged photos into Google Earth

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:

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.

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.






PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.

Comments

  1. Great work here 🙂
    Very useful tool…
    thanks for the effort…
    I came across a “bug” and I thought I should report this 🙂

    When you feed several images to this tool, it reads the Geo-tags correctly but when adding file names the images get shuffled!!
    the order of the images is lost… so the images are pinned to a different location (the location ff another image!!)

    here you can see an example…

    the files in this image are supposed to be Geo-coded from south to north in order…
    (1 then 2 north of it, then 3, 4, 5, ….)


    [IMG]http://i67.tinypic.com/33ynwuo.jpg[/IMG]
    http://i67.tinypic.com/33ynwuo.jpg

  2. I’ve also had the image shuffling problem. I had a large number of images, and a few locations had two photos and a few were missing.

  3. Hi, just tried the above create KML on my Mac – It would open another browser with the KML text. When I save the KML file and open it on Google Earth, I get the error:
    Failed: parse error at Line 1, column 0: Not well formed (invalid token). Copy and paste some of the text of the file:
    Geotagged Photos:/camera_mode.pngIMG_1535.JPG</

  4. Found the problem – I had to use another text editor. Saved as format Encoding Unicode UTF-8 and Line Breaks Unix (LF). Have the photo shuffling been fixed? Thank you for your work!

  5. Sasha Ponomarov says:

    Hi, I think I’ve fixed the bug with photos shuffling. You can try it out here:
    https://plnkr.co/wOoCthgjnHVFgGd4x5WZ
    It is simple: in readExif() function I added “photo.name = this.name;” before pushing photo into photos array, and then, in buildKML() function I used this property instead of files[f].name. This way we can be sure that file names won’t get shuffled.

    • Kathleen Wade says:

      I tried your new solution, but can’t tell if the problem is fixed because the KML no longer allows the thumbnails of the photo to be see in Google Earth. The camera icon appears at the geotagged location, but I see an empty black outline instead of the photo I used to see after running the original program.

      • Stephanie Rooke says:

        Did you find resolution to this problem? I’m having the same issue.

    • You did fix it. Thank you. The thumbnails didn’t work for me previously.

    • Sasha’s fix also worked for me. It would be cool if the program on this page could be fixed to reflect the changes, so my boss is less confused when I send him the tool. This is a GREAT help and much appreciated.

  6. Here’s an interesting one. My iPhone photos taken with the iPhone held opposite way up are displaying inverted in Google Earth following import.

  7. Christopher Rowley says:

    Thank you for creating this tool. You’ve just helped a couple of search and rescue teams out!

  8. Could you somehow include gps altitude to display the photo at the correct height?

  9. ehsansabeti says:

    great!
    Thanks so much

  10. j.catd6 says:

    My photo is placed correctly but there is only an outline of the photo, the photo is not displayed. It’s like a floating picture frame. Curious.

  11. I used to use Picasa web albums to store my photos, that were geo-tagged, then it was simple as Picasa created the kml file on my behalf. Hey presto, open in GEPro and the locations and the thumbnails were there and clickable to expand to the whole image. That no longer works. Anyone have a complete solution now that Picasa Web albums is dead? So many thanks in advance, from a Kiwi from NZ.

    • I’m looking for this same answer as well, since Picassa’s map view is not as versatile as Google Maps.

    • Len Gibson says:

      Panoramio was great for adding Photos but Google killed it and Picassa and now it seems you have to use Google Photos and so far there isnt much help with the new Google Photos, from what I have researched its not as easy or accurate as Panoramio and you can’t look up the Photographer to view there other photos

  12. Does not give me any KML file after clicking the create KML button.

  13. Debbie Care says:

    Hi , this used to work for me but has now stopped working? choose files or photos and then nothing happens? Any ideas? From another kiwi

  14. Qazi Abbasi says:

    Same issue as Debbie reported.. It used to work, but it is not working anymore.
    Please help

    • Timothy Whitehead says:

      Thank you for letting us know. I am looking in to it.

    • Timothy Whitehead says:

      It should now be working.

      • Not working for me now. I’ve updated Java and tried several different browsers. Would be a great tool, great work anyway!

      • Inspecting the javascript button, it showed the problem, I get the error “TypeError: exifData.GPSAltitude is undefined” so the script doesn’t do anything. After editing the EXIF and adding an altitude, it works. So in fact it’s currently not as stated above, that the script automatically sets an altitude of 10m above the ground, the script simply doesn’t doesn’t do anything if it does not detect an altitude in the EXIF. I hope that it will be easy to fix, good luck!

  15. Hi Thank you for this tool
    Although I put the kml file in the same photos folder, only the location and name of the photo is appearing in google earth Pro without the photo content.
    Doses this in relation with the photo size? (3Mb)
    Thanks,

    • Timothy Whitehead says:

      Thank you for letting me know. I think I have it fixed now. Please refresh the page then try it again.

  16. I get the photo outline with no photo also,…

  17. I also get only an outline of the photo. Is there a fix for this?

  18. I also get only an outline of the photo. I noticed the photo properties in Google Earth don’t include the network path. Does that have something to do with it?

  19. Bruce Moreira says:

    Hello,
    This is a great tool. We’re having issues with two things. One, can the tool be set to that is no longer zooms into a tilt view when showing the photo? For our mapping, it is easier to remain in a view from above (i.e. untilted). Two, is there a way to “fix” the photo locations when the GPS is off? With typical placemarks, they can be moved to a new location when the properties window is open. I cannot make this happen in the photo point created by this tool.
    Everything else works great.

    Thanks so much.

    • David Faulkner says:

      I second this request. I preferred the way picasa showed the images (thumbnails) rather than this ‘suspended’ view of the photo in a tilted landscape.

  20. This is great, Timothy! But is there a way to create a KML file with the photos imbedded in the description of placemarks instead of projecting as overlays? The overlays get a bit overwhelming when I’m dealing with a large number of photos in a small area.

  21. Sean Werle says:

    This is awesome, thank you!

  22. Juan Hernandez says:

    Excellent tool, thanks

  23. Daniel DiCenso says:

    Great tool! It’s worked for 11 of my 13 projects so far but for some reason it won’t work for 2 of them. The two vary from 25 pictures to 180 pictures. I’ve verified that the photos from both projects have GPS data tagged to the photos. I choose the files and click on create KML file but nothing happens.

  24. Daniel DiCenso says:

    I’ve tried 3 different browsers and two different computers as well.

  25. GEORGIOS PETROPOULOS says:

    Hi, I discovered that if a picture doesn’t have the altitude information tagged then the tool doesn’t work. Nothing happens by pressing the “CREATE KML FILE” button. I believe that is the problem Daniel DiCenso faced too.
    Is there a way to fix it?
    Thank you.

  26. found something similar , but images will be shown in pop ups. Images to Google Earth v0.3.0 free online application. http://s.wtsolutions.cn/gps-en.html

  27. Suzanne Simpson says:

    Thanks for creating this tool. Is there a capacity limit where it only accepts a certain MB of photos? All of my photos are geotagged and have altitude, but if I select more than 4, the tool stops working.

  28. Executive Engineer says:

    when we are creating KML files from numbers of photos, some are unsuccessful to create the KML file. Plz reply about it.

  29. Madhabananda says:

    i can’t make a KML file although the photos have latitude and longitude



PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.