Problem with KML file generated by fmt file

Started by jamesl, May 16, 2011, 10:04:34 AM

Previous topic - Next topic

jamesl

Hello all,

I'm using a modified form of Phil's kml.fmt file to generate a KML file to display photos at the position they were taken. Everything works OK except that in the display of the photo the <styleUrl> line of the KML file is displayed.

Here is a sample KML file generated from my modified fmt 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">
         <geomScale>.75</geomScale>
         <IconStyle>
            <color>ffffffff</color>
            <Icon>
               <href>root://icons/palette-4.png</href>
               <x>192</x>
               <y>96</y>
               <w>32</w>
               <h>32</h>
            </Icon>
         </IconStyle>
      </Style>
      <Style id="View">
         <IconStyle>
            <color>ffffffff</color>
            <Icon>
               <href>root://icons/palette-3.png</href>
               <x>160</x>
               <y>128</y>
               <w>32</w>
               <h>32</h>
            </Icon>
         </IconStyle>
      </Style>
      <Folder>
         <name>Waypoints</name>
         <open>0</open>         
<Placemark>
           <description><![CDATA[
<table width="300">
<tr><td>
Click on photo for enlarged image
</td></tr>
<tr><td>
<a href="../album/slides/DSC_0003.jpg" target=_blank>
                                <img src='../album/slides/DSC_0003.jpg'
                                    width='132' height='200'>
</td></tr>
<tr><td>GPS coordinates: <br>long: 5.819989 E lat: 45.343074 N
<br>altitude: 1019.00 m
                                </td></tr></table>]]></description>
   <Snippet/>
   <name>Chapelle du Rosaire</name>
            <styleUrl>#Photo</styleUrl>    
            <Point>
               <altitudeMode>clampedToGround</altitudeMode>
               <coordinates>5.81998932650278,45.3430739115472,0</coordinates>
            </Point>
         </Placemark>
</Folder>
   </Document>
</kml>

The display looks OK, with a small camera icon at the point of the photo, and when one clicks on the camera icon the data in the <description> tag is displayed correctly, including the image, except that there is an additional line:
StyleUrl   #Photo
at the bottom of the display.

For an on-line example see: http://www.loveluck.net/photos/2011-05-12-Col-de-la-Saulce/kml/2011-05-12-Col-de-la-Saulce-kml-gpx.html.

Can anyone see anything wrong with the KML code?
One point I don't understand is the use of <Snippet/> instead of the usual <Snippet>..text ..</Snippet> format.

Thanks in advance,

James

Phil Harvey

Hi James,

The <snippet/> syntax is used for an empty element (equivalent to <snippet></snippet>).

I can't say why the StyleURL shows up in your display, but why not just remove this element and see what happens?

Also, you may get better luck with answers in KML forum if you post the generated KML 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 ($).

jamesl

Phil,

Thanks for your reply.
In fact, it seems that the problem is not cased by the KML code. I tried a modified version with Google Earth, with the local file reference replaced by a URL, and the 'StyleUrl #Photo' text did not appear (either with or without the <Snippet/> tag). So it seems like the problem arises because of the way the KML file is called from the html file. I'm using javascript code for the French IGN Geoportail API to call the KML file, and it seems like the <StyleUrl> tag is getting interpreted as html, although it's hard to understand why only this line gets treated this way.
There is a discussion forum for the Geoportail API, so I'll try posing the question in this forum.

I think we can consider this subject as closed as far as exiftool is concerned.

James