Union Mode ⭐
Union Mode ⭐
You can enable Union Mode for all layers on a map like this:
map.pm.enableGlobalUnionMode();
The union mode in Leaflet-Geoman allows users to merge two leaflet layers into one. This mode can be enabled programmatically or through the provided toolbar. It supports merging polygons (or multipolygons). The union mode simplifies combining geometries. The union mode works by selecting two layers to union, then the union mode will create a new layer that is the union of the two selected layers. The new layer will be added to the map and the two selected layers will be removed from the map.
The following methods are available on map.pm
:
Method | Returns | Description |
---|---|---|
enableGlobalUnionMode() | - | Enables global Union Mode. |
disableGlobalUnionMode() | - | Disables global Union Mode. |
toggleGlobalUnionMode() | - | Toggles global Union Mode. |
globalUnionModeEnabled() | Boolean | Returns true if global Union Mode is enabled. false when disabled. |
The following events are available on a map instance:
Event | Params | Description | Output |
---|---|---|---|
pm:globalunionmodetoggled | e | Fired when Difference Mode is toggled. | enabled , map |
pm:union | e | Fired when a new layer is created by union of two other layers. | resultLayer , mergedLayers |
Example
Loading...