Skip to main content

Draw Circle Marker Mode

Circle Marker Mode allows you to add circle markers to the map. Circle markers are circles with a fixed radius in pixels that maintain their screen size regardless of zoom level.

Circle marker, marker or circle?​

ShapeUse it forBehavior when zooming
Circle markerPoint locations with a simple round symbolKeeps a fixed pixel radius
MarkerPoint locations shown with a marker symbolKeeps a screen-sized symbol
CircleA geographic area around a centerIts screen size changes with map zoom

A circle marker represents a point location, not a geographic buffer. Choose Draw Circle when the area on the ground matters.

Enable circle marker drawing​

Create the Geoman instance using the installation guide first. Wait for it to finish initializing before activating a tool:

geoman.mapAdapter.once('gm:loaded', () => {
geoman.enableDraw('circle_marker');
});

On an already initialized map, the following methods let your own controls toggle drawing:

map.gm.enableDraw("circle_marker");
map.gm.disableDraw();
map.gm.toggleDraw("circle_marker");
map.gm.drawEnabled("circle_marker");

// Or like this:
map.gm.enableMode("draw", "circle_marker");
map.gm.disableMode("draw", "circle_marker");
map.gm.toggleMode("draw", "circle_marker");
map.gm.isModeEnabled("draw", "circle_marker");

The following events are available on a map instance:

EventParamsDescriptionOutput
gm:drawstarteventFired when circle marker drawing starts.map, shape
gm:createeventFired when a circle marker is created.map, shape, feature

Behavior​

Circle marker drawing operates by:

  1. Clicking on the map to place the circle marker center
  2. The circle marker is created with a default radius
  3. The circle marker maintains its pixel size regardless of zoom level

Export the drawn points​

Read the feature collection after a user creates a feature, or from your own save button. Keep the Geoman feature properties when you plan to import the data again.

geoman.mapAdapter.on('gm:create', () => {
const data = geoman.features.exportGeoJson();
console.log(data);
});

If no toolbar appears, check that both MapLibre and Geoman CSS are loaded and that the map container has a nonzero height. If drawing is enabled too early, move that call into gm:loaded as shown above. See the event reference for more interactions.

Live Draw Circle Marker Example​