Raruto / leaflet-kmz

A KMZ file loader for Leaflet Maps
GNU General Public License v3.0
49 stars 27 forks source link

hotSpot not supported #38

Closed frashpikass closed 1 year ago

frashpikass commented 1 year ago

Hello! The problem I'm facing with is that whenever a KMZ is loaded, marker icons will always be placed centered on their center. For example, look at how this icon is rendered on the Leaflet map:

image

This is how it looks on Google Earth:

image

As you can see, the narrow tip of the teardrop should centered on the road. This is how the icon is styled in the kml:

<Style id="icon-1899-097138-labelson-nodesc">

  <IconStyle>
    <Icon>
      <href>files/icon-4.png</href>
    </Icon>
    <hotSpot x="32" y="64" xunits="pixels" yunits="insetPixels"/>
  </IconStyle>

  <BalloonStyle>
    <text><![CDATA[<h3>$[name]</h3>]]></text>
  </BalloonStyle>

</Style>

I'm using Leaflet KMZ v1.0.9 and Leaflet v1.9.4.

Raruto commented 1 year ago

Hi Frash,

the \<hotSpot> and \<BalloonStyle> tags are currently not supported.

Within old issues you can find described an alternative solution that you can try to implement it by yourself:

https://github.com/Raruto/leaflet-kmz/blob/ed43fe930ddd93267278ad0c734ce699ecdd607a/src/KMZLayer.js#L55

https://github.com/Raruto/leaflet-kmz/blob/ed43fe930ddd93267278ad0c734ce699ecdd607a/src/KMZLayer.js#L60-L138

For more info:

👋 Raruto