Author Topic: KML file "corrupted"  (Read 2337 times)

Manky

  • Newbie
  • *
  • Posts: 3
KML file "corrupted"
« on: February 02, 2014, 05:01:40 PM »
Hi All,
I've used exiftool to successfully make a kml file with a single photo that does everything I need - it creates a little camera icon at the photo location which displays the photo when clicked. Perfect!
What I am now trying to do is create multiple kml files (one for each of the photos in a directory) in a single command so that I can then zip them all into a kmz.
I have gotten as far as writing the kml format code for all of the photos into a single kml file, but Google Earth apparently doesn't like that and gives me a "junk after document element" message.
So, my question is, how do I get exiftool to generate a separate kml file for each of the photos in a directory (without repeating the process x times)?
Thanks in advance!
Joe

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: KML file "corrupted"
« Reply #1 on: February 03, 2014, 07:09:37 AM »
Hi Joe,

I don't think that you really want a separate KML for each image.  Your problem is likely just a formatting error in the KML syntax.  Did you take a look at fmt_files/kml.fmt in the full ExifTool distribution?

If you really do want a separate KML for each image, the -w option will do this for you.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Manky

  • Newbie
  • *
  • Posts: 3
Re: KML file "corrupted"
« Reply #2 on: February 03, 2014, 11:41:16 PM »
Thanks for your prompt response Phil!

Yes, it was a formatting problem - I was printing the entire kml.fmt file for each picture/placemark one after the other in the kml file instead of only printing the header and tail information only once.  I was under the impression that I needed a single kml file per picture that then needed to be zipped into a kmz, and didn't realise a single kml file could have multiple placemarks/photos.  I edited the file manually this time, but I found your instructions for making a batch file here http://cpanforum.com/posts/4346 so will have a crack at getting that running.

Thanks again!

Joe

Manky

  • Newbie
  • *
  • Posts: 3
Re: KML file "corrupted"
« Reply #3 on: February 04, 2014, 12:11:35 AM »
Just an update Phil - the batch file combined with separate header, body and tail files to write the kml are working a treat!  Thanks so much for this software :D

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: KML file "corrupted"
« Reply #4 on: February 04, 2014, 07:19:40 AM »
I'm glad it is working, but those instructions are outdated.  Instead, this may be done by a single command.  See the comments in fmt_files/kml.fmt for details.  Also see here.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).