Draw Ellipse Mode
Ellipse Mode allows you to add ellipses to the map by defining a center point and two radii (x and y semi-axes).
You can enable Draw Ellipse Mode like this:
map.gm.enableDraw("ellipse");
map.gm.disableDraw();
map.gm.toggleDraw("ellipse");
map.gm.drawEnabled("ellipse");
// Or like this:
map.gm.enableMode("draw", "ellipse");
map.gm.disableMode("draw", "ellipse");
map.gm.toggleMode("draw", "ellipse");
map.gm.isModeEnabled("draw", "ellipse");
The following events are available on a map instance:
| Event | Params | Description | Output |
|---|---|---|---|
gm:drawstart | event | Fired when ellipse drawing starts. | map, shape |
gm:create | event | Fired when an ellipse is created. | map, shape, feature |
Behavior
Ellipse drawing operates by:
- Clicking on the map to place the ellipse center
- Moving the mouse to adjust the x semi-axis (width)
- Clicking to set the width, then moving to adjust the y semi-axis (height)
- Clicking again to finalize the ellipse
The ellipse is represented as a GeoJSON polygon with smooth edges for rendering. The feature properties include:
xSemiAxis: The horizontal radius of the ellipseySemiAxis: The vertical radius of the ellipsecenter: The center point coordinates