Main Menu

Activating Google Earth

Started by evilaro, February 05, 2013, 11:59:10 AM

Previous topic - Next topic

evilaro

Hi:
a)
I wonder if there is a option using Exiftool, that
if a image contains a valif Coordenate, it opends Google
Earth with that Coordenates.
Or any suggestion on how to do it.

b)
If you are using Google Earth and you PIN a place
it shows the coordinates of the PIN.

Is there any way to pass this coordinates to a image automatically.

I do it COPY&PAste but it is a pain ;)

Thanks a lot

Emilio

www.evilfoto.eu
*************

Phil Harvey

Hi Emilio,

There are various utilities that will do this (Geosetter comes to mind).

With ExifTool alone, the closest thing you could do is:

1) Use ExifTool to create a .kml file:

exiftool -p kml.fmt image.jpg > out.kml

2) Open "out.kml" in Google Earth.

(The "kml.fmt" file is included in the full ExifTool distribution.)

The cool thing about this technique is that you can generate a KML file for a collection of images, then see them all together in Google Earth.

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

evilaro

Phil:

Thanks... that works... and very nicelly ;)

Since you comment that I can see the images on G. earth
I got a problem:

When I activate the out.kml it takes me to the correct gps position
and the pointing mark has the name of the image (just the name, not the whole path)
If I click on the pointing mark it seem that is trying to open the image since it opens
a TAB with the name of the image, but the image is not shown.

IS there supposed to be the image visible?
If so Where I have to put the Image on my computer, I have tried
in the original place I opened, and then on the defaul directory
where I am working...

Any sugestion?

That would be nice to see the image in G. Earth

Do you have a correct klm file I can see

Thanks

Emilio




Quote from: Phil Harvey on February 05, 2013, 12:09:12 PM
Hi Emilio,

There are various utilities that will do this (Geosetter comes to mind).

With ExifTool alone, the closest thing you could do is:

1) Use ExifTool to create a .kml file:

exiftool -p kml.fmt image.jpg > out.kml

2) Open "out.kml" in Google Earth.

(The "kml.fmt" file is included in the full ExifTool distribution.)

The cool thing about this technique is that you can generate a KML file for a collection of images, then see them all together in Google Earth.

- Phil
www.evilfoto.eu
*************

Phil Harvey

#3
If you use a relative path, then the path will have to be relative to the directory that the KML file is in.  I'm not sure if it will work with an absolute path.

- Phil

Edit:  You definitely need to use a relative path.  But if you do this and place out.kml in the directory from which you ran the command, then it should work.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

I was playing with this to be sure it still worked, and it does, but changes to Google Earth had broken the camera icon that I was using.  Here is an update that fixes this:

#------------------------------------------------------------------------------
# File:         kml.fmt
#
# Description:  Example ExifTool print format file for generating a
#               Google Earth KML file from a collection of geotagged images
#
# Usage:        exiftool -p kml.fmt FILE [...] > out.kml
#
# Revisions:    2010/02/05 - P. Harvey created
#               2013/02/05 - PH Patched to get camera icon working again
#
# Notes:     1) All input files must contain GPSLatitude and GPSLongitude.
#            2) For Google Earth to be able to find the images, the input
#               images must be specified using relative paths, and "out.kml"
#               must stay in the same directory as where the command was run.
#            3) The -fileOrder option may be used to control the order of the
#               generated placemarks.
#------------------------------------------------------------------------------
#[HEAD]<?xml version="1.0" encoding="UTF-8"?>
#[HEAD]<kml xmlns="http://earth.google.com/kml/2.0">
#[HEAD]  <Document>
#[HEAD]    <name>My Photos</name>
#[HEAD]    <open>1</open>
#[HEAD]    <Style id="Photo">
#[HEAD]      <IconStyle>
#[HEAD]        <Icon>
#[HEAD]          <href>http://maps.google.com/mapfiles/kml/pal4/icon38.png</href>
#[HEAD]          <scale>1.0</scale>
#[HEAD]        </Icon>
#[HEAD]      </IconStyle>
#[HEAD]    </Style>
#[HEAD]    <Folder>
#[HEAD]      <name>Waypoints</name>
#[HEAD]      <open>0</open>
#[BODY]      <Placemark>
#[BODY]        <description><![CDATA[<br/><table><tr><td>
#[BODY]        <img src='$directory/$filename'
#[BODY]          width='$imagewidth' height='$imageheight'>
#[BODY]        </td></tr></table>]]></description>
#[BODY]        <Snippet/>
#[BODY]        <name>$filename</name>
#[BODY]        <styleUrl>#Photo</styleUrl>
#[BODY]        <Point>
#[BODY]          <altitudeMode>clampedToGround</altitudeMode>
#[BODY]          <coordinates>$gpslongitude#,$gpslatitude#,0</coordinates>
#[BODY]        </Point>
#[BODY]      </Placemark>
#[TAIL]    </Folder>
#[TAIL]  </Document>
#[TAIL]</kml>


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

evilaro

Hi Phil:

Thanks for the help.

NOw I get the camera, instead of a square.

But still I get the name of the file not the actual image.

I thought it was a size limet... I was using a 5mb image, I thought
that was the reason...

So I reduced it to 10 kb
Still the same...

What I am making wrong.

I am attaching a small screen shot of what I get in G. Earth.

Let me know if sending you my .kml will
help.

Thanks

Emilio
www.evilfoto.eu
*************

Phil Harvey

I can't look at your screenshot right now, but I don't think it would help.

You need to click on the camera icon to see the image.  Did you try that?

You can make it so that you don't need to click, I do that with my own KML files, but I wouldn't advise trying this with such a large image.

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

evilaro

Phil:

If I do not click on the Camera Icon I see the Camera Icon
and the name of the file besides the Icon, as per my screen shot

If I click on the Icon, a white box shows up which includes again the
name of the image, see new screen shot. This white box size depends
on the size of the image. But THE IMAGE IS NOT THERE.
In another words, G. Earth nows which image is, it knows its size,
but can not place it.

The image is a .JPG, should it be something else?

I am posting my .kml which I name pppp.kml

I hope there is a solution....

Thanks

Emilio




Quote from: Phil Harvey on February 05, 2013, 06:36:51 PM
I can't look at your screenshot right now, but I don't think it would help.

You need to click on the camera icon to see the image.  Did you try that?

You can make it so that you don't need to click, I do that with my own KML files, but I wouldn't advise trying this with such a large image.

- Phil
www.evilfoto.eu
*************

Phil Harvey

Hi Emilio,

You have used an absolute path in your file name.  Instead of "C:/AYJ/IMAGENES_AYJ/IMAG_XXX_MADRE2.JPG", you must do something like this:

cd c:
cd \AYJ
exiftool -p "c:\some directory\kml.fmt" "IMAGENES_AYJ/IMAG_XXX_MADRE2.JPG" > out.kml


Then do not move out.kml from this directory before you open it with Google Earth.

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

Phil Harvey

Just for fun I am attaching a KMZ (zipped KML) file as an example of what else you can do with these.  I made this a few years ago from pictures I took while flying in a small plane over Cape Hatteras, North Carolina.

This example doesn't help with your problem (because the images are on a web server and not your hard disk), but it does give an example of how to link images of various sizes.

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

evilaro

Phil:

Can I Cry? buuuuuuuuuuuuuuuu

I state that I got my pictures in my computer I have changed
to all the paths I could think of, and still The images do not show up.

You send me a .kmz   and I understand that you state that I can not see
your pictures because the are not on my computer....

AND I SEE ALL OF THEM .... very very small though maybe 60x40 pixels ;)

Still there is a difference on what I get with my .kml and you kmz

MY  CASE      I see the icon and the image name
YOUR CASE   I see all the icons no names or pictures

If I click on mine I see the box but not image

If I click on yours I see the picture and the filename.

I feel the problem must be very simple

I would appreciate if you coud post a simple .KML  (.not KMZ)
that works for you.

I would compare with mine and put a image to see whats the problem.

Thanks a lot for your help, it is appreciated.

Emilio





Quote from: Phil Harvey on February 06, 2013, 11:00:10 AM
Just for fun I am attaching a KMZ (zipped KML) file as an example of what else you can do with these.  I made this a few years ago from pictures I took while flying in a small plane over Cape Hatteras, North Carolina.

This example doesn't help with your problem (because the images are on a web server and not your hard disk), but it does give an example of how to link images of various sizes.

- Phil
www.evilfoto.eu
*************

Phil Harvey

I'm sorry if I confused you by posting my KMZ file.  As I said, I didn't think it would help in solving your problem.

On my Mac OS computer here, running ExifTool 9.xx and Google Earth 6.2.2, this works:

> exiftool -p kml.fmt a.jpg > out.kml
> open -a 'Google Earth' out.kml


When Google Earth opens, it shows the camera icon, and when I click on it I see my original "a.jpg" image.

Here is the "out.kml" file:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
  <Document>
    <name>My Photos</name>
    <open>1</open>
    <Style id="Photo">
      <IconStyle>
        <Icon>
          <href>http://maps.google.com/mapfiles/kml/pal4/icon38.png</href>
          <scale>1.0</scale>
        </Icon>
      </IconStyle>
    </Style>
    <Folder>
      <name>Waypoints</name>
      <open>0</open>
      <Placemark>
        <description><![CDATA[<br/><table><tr><td>
        <img src='./a.jpg'
          width='2048' height='3072'>
        </td></tr></table>]]></description>
        <Snippet/>
        <name>a.jpg</name>
        <styleUrl>#Photo</styleUrl>
        <Point>
          <altitudeMode>clampedToGround</altitudeMode>
          <coordinates>-1.91416700013333,54.989667,0</coordinates>
        </Point>
      </Placemark>
    </Folder>
  </Document>
</kml>


Notice <img src="./a.jpg" ....  This is the important part, and is how Google Earth finds the image.  The file name must be a valid HTML URL for this to work.

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

evilaro

Phil:

Good news and really AMAZIN G news.

I got your .KML

I renamed my image to a,jpg

And I saw it.... perfect...

So I thought there was a problem of the .KML

No differende.....

AND I FOUND IT.

*********** oh well I feel that I found it, at least it works forme my w7 OS and my computer, maybe not in others
***********please let me know is this that I am stating is correct.

if THE   .jpg is in CAPITAL ....IT DOES NOT WORK

so a.JPG    will not work.

It is irrelevant if the name of the image ON THE COMPUTER is in lower or capital letters

but the .jpg in the .kml MUST be in lowe case


aaaa.BBBB.cccc.jpg    will work

aaaa.BBBB.cccc.JPG will NOT work


So I feel is not your problem since you pass the parameters you are given,,,,

Althought if this is true ... you could assure the .jpg is always lowe.

So if this is true, either is a Google Earth Problem or that it is documented and I did not know it , or it is just
a problem on my computer.

Well

Thanks for the help

Emilio




www.evilfoto.eu
*************

Phil Harvey

Hi Emilio,

I'm glad you found the problem.  I wouldn't have thought of this, and don't understand why Google Earth would require a lower case file extension.  I made a note about this in the kml.fmt file.

- Phil

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

evilaro

Phil:

As I said, that is how it works in my computer

if you change in the kml file your picture name to a.JPG and
it does not work, then that is it.


Thanks...

Emilio





Quote from: Phil Harvey on February 07, 2013, 07:05:59 AM
Hi Emilio,

I'm glad you found the problem.  I wouldn't have thought of this, and don't understand why Google Earth would require a lower case file extension.  I made a note about this in the kml.fmt file.

- Phil
www.evilfoto.eu
*************