Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing icons when loading plain kml #10

Closed
bugfindr opened this issue Jul 21, 2020 · 7 comments
Closed

Missing icons when loading plain kml #10

bugfindr opened this issue Jul 21, 2020 · 7 comments

Comments

@bugfindr
Copy link

In latest version, facing issue with Icon property in KMZLayer.js file.

image

image

That's says undefined icon property. Please help on the same.

@Raruto
Copy link
Owner

Raruto commented Jul 22, 2020

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

@bugfindr
Copy link
Author

bugfindr commented Jul 23, 2020

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.
image

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.

demo-test.zip

KMZ output on Map.
image

KMZ Output on Google Earth.
image

@Raruto
Copy link
Owner

Raruto commented Jul 23, 2020

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:

_geometryToLayer: function(data) {

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

@Raruto Raruto changed the title Bug in latest release Missing icons when loading plain kml Jul 23, 2020
@bugfindr
Copy link
Author

bugfindr commented Jul 23, 2020

I just saw leaflet-kmz_gridlayer.html file. but there's no way to apply KMZ/KML direct to map without overrides?

@Raruto
Copy link
Owner

Raruto commented Jul 23, 2020

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);

@bugfindr
Copy link
Author

bugfindr commented Jul 23, 2020

Tested with 1.0.5 and getting error as mentioned below.

image

@bugfindr
Copy link
Author

bugfindr commented Jul 23, 2020

@Raruto Never mind. Looks like your change works now. I will back to you If I will find something.

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants