geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

Geoman optIn #517

Closed Jumpy555 closed 3 years ago

Jumpy555 commented 4 years ago

Hi, I'm using Geoman library in a map with thousands of markers.

To display markers on the map I also use leaflet markercluster.

As you can see in this fiddle, if I don't include Geoman library, the map is loading very fast: https://jsfiddle.net/odr2Lzgh/

When I include Geoman, the map is loading much slower: https://jsfiddle.net/t09djpsm/

I even tried to add L.PM.initialize({ optIn: true }); to avoid markers being taken into consideration by Geoman, but it did not have any effect.

Is there a way to initialize Geoman and specify to avoid the markers layer?

Thanks, Jumpy

Dan-Wood commented 4 years ago

Your second fiddle doesn't include Geoman at all, wrong link :) ?

This with 10k works just fine, and fast :)

https://jsfiddle.net/adfvzg7t/1/

Jumpy555 commented 4 years ago

If you look at the resources, you'll see that in the second fiddle I included Geoman library.

I didn't put the control on the map to show that, just including Geoman as a resource, the same javascript code is much slower (almost 0 seconds vs. 13 seconds).

You would say that, if I don't use it on the map, I should not include it in my resources, but I need to have a shared minified library with Leaflet, Geoman and other libraries.

What I'd like is to have the possibility to initialize Geoman only when needed on the map or, at least, specify to ignore the whole markers layer because I only need the drawing functions.

Jumpy

codeofsumit commented 4 years ago

Thanks @Jumpy555 - I'll get on this soon. Let me know if you have more infos, demos, sample data files that could help me figure this out