Skip to main content

Union Mode ⭐

Union Mode ⭐

Union Feature

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:

MethodReturnsDescription
enableGlobalUnionMode()-Enables global Union Mode.
disableGlobalUnionMode()-Disables global Union Mode.
toggleGlobalUnionMode()-Toggles global Union Mode.
globalUnionModeEnabled()BooleanReturns true if global Union Mode is enabled. false when disabled.

The following events are available on a map instance:

EventParamsDescriptionOutput
pm:globalunionmodetoggledeFired when Scale Mode is toggled.enabled, map
pm:unioneFired when a new layer is created by union of two other layers.resultLayer, mergedLayers