0

In this example: http://harrywood.co.uk/maps/examples/leaflet/kml.html a kml layer is put to a leaflet map and be default has popup bindings on the values of the kml name and description tag. However, when I try to adapt this, my layers render well, but don't show the popups on click event. The kml is well formated (I compared the XML structure of the example kml source and mine) but can't see any relevant difference.. Any pointers what might cause this issue?

Here is the live example http://tiroltrailwebmap.lima-city.de/elbaweb/test.html

KML code snippet:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<atom:author><atom:name>Locus (Android)</atom:name></atom:author>
    <Style id="track001">
        <LineStyle>
            <color>96ff0000</color>
            <width>4.0</width>
        </LineStyle>
    </Style>
<Placemark>
    <name>No28-Traverse</name>
    <description><![CDATA[<br /><br /><font color="black"><table width="100%"><tr><td><table width="100%"><tr><td align="left" valign="center"><small><b>Länge</b></small></td><td align="center" valign="center">286 m</td></tr>
<tr><td align="left" valign="center"><small><b>Punkte</b></small></td><td align="center" valign="center">12</td></tr>
<tr><td align="left" valign="center"><small><b>Erstellt</b></small></td><td align="center" valign="center">2016-08-31 08:49:41</td></tr>
<tr><td align="left" valign="center"><small><b>Max. Tempo</b></small></td><td align="center" valign="center">0.0 km/h</td></tr>
</table></td></tr><tr><td colspan="1"><hr></td></tr><tr><td><table width="100%"><tr><td align="left" valign="center"><small><b>Min. Höhe</b></small></td><td align="center" valign="center">601 m</td></tr>
<tr><td align="left" valign="center"><small><b>Max. Höhe</b></small></td><td align="center" valign="center">628 m</td></tr>
</table></td></tr><tr><td colspan="1"><hr></td></tr><tr><td><table width="100%"><tr><td align="left" valign="center"><small><b></b></small></td><td align="center" valign="center">Höhenmeter</td><td align="center" valign="center">Distanz</td></tr>
<tr><td align="left" valign="center"><small><b>Bergauf</b></small></td><td align="center" valign="center">8 m</td><td align="center" valign="center">62 m</td></tr>
<tr><td align="left" valign="center"><small><b>Bergab</b></small></td><td align="center" valign="center">-27 m</td><td align="center" valign="center">196 m</td></tr>
<tr><td align="left" valign="center"><small><b>Ebene</b></small></td><td align="center" valign="center">0 m</td><td align="center" valign="center">31 m</td></tr>
<tr><td align="left" valign="center"><small><b>Gesamt</b></small></td><td align="center" valign="center">35 m</td><td align="center" valign="center">289 m</td></tr>
</table></td></tr></table></font>]]></description>
    <styleUrl>#track001</styleUrl>
    <MultiGeometry>
        <LineString>
            <coordinates>
                10.156968,42.786333,633.00
                10.156982,42.786554,633.00
                10.157087,42.786676,626.00
                10.157423,42.786830,613.75
                10.157549,42.786982,611.75
                10.157704,42.787076,607.75
                10.158067,42.787488,602.00
                10.158192,42.787741,596.75
                10.158187,42.787891,596.75
                10.158065,42.788069,602.25
                10.158074,42.788200,601.75
                10.157962,42.788544,611.25
            </coordinates>
        </LineString>
    </MultiGeometry>
</Placemark>
</Document>
</kml>
1

You could give a try to leaflet-omnivore plugin.

See also that example on mapbox, which builds a popup with content from the <Placemark> child tags.

  • Thanks, omnivore worked! However, I'm still puzzled by the issue above.. – Kay Sep 24 '16 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.