leaflet-plugins
leaflet-plugins copied to clipboard
KML - problem with custom marker position
Hi, I have KML file with declared custom icons with
<Style id="IconCrossroad">
<IconStyle>
<scale>1.5</scale>
<Icon>
<href>../leaflet/images/icon-crossroad.png</href>
</Icon>
<hotSpot x="0.5" y="1" xunits="fraction" yunits="fraction"/>
</IconStyle>
</Style>
Icons are loaded into map succesfully, but the marker position is bad. I can't set the offset of icons - hotSpot does not work.

I have been having similar issue #281 . When you inspect the html in a browser, I noticed my margin-left and margin-top were off, then change after I refreshed which placed them correctly. Maybe different than your issue but it sure looks similar.
OK, currently I set offset in pixels:
<Style id="IconCrossroad">
<IconStyle>
<scale>1</scale>
<Icon>
<href>../leaflet/images/icon-crossroad.png</href>
</Icon>
<hotSpot x="17" y="-44" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
After first page load looks everything fine:

But after page refresh (or second page visit) are some icon group are moved again y-pixels offset:
