Missing icons when loading plain kml
bugfindr opened this issue · comments
Hi Bugfindr,
there is probably something wrong with your kmz file (e.g. missing or incorrect <Icon> tags).
To debug that you can use the following snippet:
var kmz = L.kmzLayer('demo.kmz', {
geometryToLayer: function(data) {
console.log(data);
return L.geoJson(data);
}
}).addTo(map);
Anyway, it would be better if you could also provide an example file ...
Have a nice day,
Raruto
Hi Raruto,
Thank you very much for quick response.
I just used above code snippet and I don't see above mentioned error. but If I remove geometryToLayer
then I will see again above error.
And major issue If I use geometryToLayer
then I am facing "KMZ style" issue. Looks like all geometry and icons appearance in default style (blue color). However my KMZ has different color and icons. And that KMZ working fine with google earth and google Map.
I am attaching a minor KMZ for your test including output screenshots at my end.
Also you will notice on click popup also not appearing on map. Thank You.
If I use geometryToLayer then I am facing "KMZ style" issue. Looks like all geometry and icons appearance in default style (blue color). However my KMZ has different color and icons. And that KMZ working fine with google earth and google Map.
That happens because the geometryToLayer
option overrides the following default styling function:
Line 62 in ff62f3a
For further details, here you can see a more in-depth example: leaflet-kmz_gridlayer.html.
I am attaching a minor KMZ for your test including output screenshots at my end.
Thanks for the demo file, your problem was related to the fact that the file is not actually a "zipped" folder (but a simple "kml" text file).
Take a look at version 1.0.5 and then let me know if it works.
Happy testing,
Raruto
I just saw leaflet-kmz_gridlayer.html file. but there's no way to apply KMZ/KML direct to map without overrides?
I just saw leaflet-kmz_gridlayer.html file. but there's no way to apply KMZ/KML direct to map without overrides?
I don't think I understand well, however, have you tried (with version 1.0.5) to simply doing so?
var kmz = L.kmzLayer('demo.kmz').addTo(map);