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

Documentation question #1006

Closed mlmarius closed 3 years ago

mlmarius commented 3 years ago

I was just getting acquainted with the documentation and in the getting started section I see this example:

layer.setStyle({pmIgnore: false});
// layer.options.pmIgnore = false; // If the layer is a LayerGroup / FeatureGroup / GeoJSON this line is needed too
L.PM.reInitLayer(layer); 

Problem is, I don't know how layer is initialized. Could you please explain?

Falke-Design commented 3 years ago

With pmIgnore you can define if a layer is available for Geoman. pmIgnore: false is only needed if you set L.PM.setOptIn(true);, because by default all layers are "hidden" for Geoman.

So you don't need to use this code by default

mlmarius commented 3 years ago

Hi and thanks for the reply. I was wondering how the layer object is created. What type of layer is it. As a newcomer, I find the multitude of layers Leaflet offers a bit confusing and I don't know what type of layer the object in the example is.

Falke-Design commented 3 years ago

It has no specific layer type, it can be L.Marker, L.Circle, L.CircleMarker, L.Rectangle, L.Polyline, L.Polygon, L.ImageOverlay, and ever other Layer. It is simply your layer object that you have created. For example: var layer = L.marker([0,0]).addTo(map)