Skip to main content

Snap Guides Helper Mode

The Snap Guides Helper Mode adds visual guidelines that assist in snapping features to specific angles or points during map editing. This mode is useful when precise alignment is necessary while creating or modifying shapes.

You can enable Snap Guides Helper Mode with the following methods:

map.gm.enableMode('helper', 'snap_guides');
map.gm.disableMode('helper', 'snap_guides');
map.gm.toggleMode('helper', 'snap_guides');
map.gm.isModeEnabled('helper', 'snap_guides');

Events for Snap Guides Helper Mode

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:globalsnappingmodetoggledeventFired when Snap Guides Helper Mode is toggled.enabled, map

Example Usage

You can listen for specific Snap Guides Helper Mode events on the map instance like this:

map.on('gm:globalsnappingmodetoggled', (event) => {
console.log(event);
});

Behavior

Snap guides work with the following shape types:

  • Lines
  • Polygons
  • Rectangles
  • Circles
  • Multi-polygons

The Snap Guides helper:

  1. Calculates and displays guidelines at specific angles or along existing features.
  2. Helps users to snap to key points like intersections or perpendicular lines.
  3. Snaps features to the closest guide point, with priority given to perpendicular or aligned snapping guides.
  4. Custom snapping tolerance can be configured for guides.

Live Snap Guides Example