Google Location Services[1] generates KML that exiftool can't grok. The attached patch + sample data + test case demonstrates the problem. My fix (massaging spaces into commas) is not ideal but does not require reworking the main 'split' logic.
[1] https://maps.google.com/locationhistory/b/0/
Thanks for exiftool. I think I'm going to find it very useful.
Wow. I think this is the first time anyone has ever submitted a patch that included a test.
Well done!
This patch will be included in ExifTool 9.41.
- Phil
I made one small change to ensure that the massaging of spaces doesn't break anything else:
- s/(-?\d+\.\d+)\s+(-?\d+\.\d+)\s+(\d+)/$1,$2,$3/;
+ s{(\S+)\s+(\S+)\s+(\S+)(</gx:coord>)}{$1,$2,$3$4};
I hope this is OK.
Also, the last gx:coord in t/images/Geotag.kml was missing a space before the altitude, so I added it.
Thanks again for this patch!
- Phil
Oh, nice. That's much safer than mine, as well as more maintainable.
The missing space was the result of a botched perl -pi.BAK I ran to sanitize the coordinates. Thanks for catching that, as well as for your prompt responses.