Jin Igarashi
Software Engineer, Fracta Inc
An introduction for newcomers
Until you have to build it.
Leaflet.draw, leaflet-freedraw, mapbox-gl-draw... different APIs, different behaviour, different bugs — and your drawing code is locked to one map.
An open source TypeScript library for drawing on web maps, created by James Milner about four years ago.
One drawing engine, many maps.
npm install terra-draw
Adapter talks to the map · Modes own the interaction · Store holds the GeoJSON.
Swap the adapter, keep everything else.
point
linestring
polygon
marker
polyline
rectangle
angled-rectangle
circle
sector
sensor
freehand
freehand-linestring
select
What does TerraDraw help you achieve?
import { TerraDraw, TerraDrawPolygonMode } from 'terra-draw'; import { TerraDrawMapLibreGLAdapter } from 'terra-draw-maplibre-gl-adapter'; const draw = new TerraDraw({ adapter: new TerraDrawMapLibreGLAdapter({ map }), modes: [new TerraDrawPolygonMode({ snapping: true })] }); draw.start(); draw.setMode('polygon');
draw.on('finish', (id) => { const snapshot = draw.getSnapshot(); const feature = snapshot.find((f) => f.id === id); console.log(JSON.stringify(feature)); });
getSnapshot() / addFeatures() — load, save and round-trip your features with anything that speaks GeoJSON.
getSnapshot()
addFeatures()
New features to use in your project
Common in every drawing application, one of the most requested features — and hard to get right.
draw.undo(); draw.redo();
New ways to style your geometries — style callbacks receive the feature, so colour, width and opacity can depend on your own properties.
line mode now supports dashed lines, with a new lineStringDash style property.
lineStringDash
Lines that can be closed into polygons: start drawing a line and finish it as an area, without switching mode.
Register one mode twice with different configurations — for example two polygon modes with different styling and validation.
Click and drag support: drag out a rectangle or a circle in one gesture instead of clicking corner by corner.
Terra Draw gives you the drawing engine — the buttons, the mode switching and the map controls are yours to write.
A MapLibre GL JS plugin: Terra Draw plus a ready-made control.
npm install @watergis/maplibre-gl-terradraw
Then, just one line of code to add the control to your MapLibre map:
import { MaplibreTerradrawControl } from '@watergis/maplibre-gl-terradraw'; map.addControl( new MaplibreTerradrawControl({ open: true }), 'top-left' );
MaplibreMeasureControl adds distance and area labels to the geometries as you draw them.
MaplibreMeasureControl
Draw a line, get a route back — the isochrone and routing controls turn drawn geometry into an API request.
UNDP's GeoHub uses the plugin for drawing and measuring.
How you can get involved with the Terra Draw project
The FOSS4G 2026 workshop runs through all of this in the browser, with a live editor on every page:
Terra Draw workshop - https://workshops.terradraw.water-gis.com/workshops/foss4g2026/
No install, no build step — edit the code and the map updates.
Thank you for listening