Terra Draw
Multi-library drawing tool
Maintained by James Milner
A cross-library drawing tool that works with MapLibre GL JS, Leaflet, OpenLayers, and Google Maps. Draw and edit geometries with a consistent API.
Live demo
Terra Draw running on MapLibre GL JS in your browser
Loading the map…
Demo code
import { TerraDraw, TerraDrawPolygonMode, TerraDrawSelectMode } from "terra-draw";
import { TerraDrawMapLibreGLAdapter } from "terra-draw-maplibre-gl-adapter";
import type { PluginDemo } from "../types";
export default {
center: [-0.1276, 51.5072], // London
zoom: 14,
run({ map }) {
const draw = new TerraDraw({
adapter: new TerraDrawMapLibreGLAdapter({ map }),
modes: [
new TerraDrawPolygonMode(),
new TerraDrawSelectMode({
flags: {
polygon: {
feature: {
draggable: true,
coordinates: { midpoints: true, draggable: true, deletable: true },
},
},
},
}),
],
});
draw.start();
// One polygon to start with.
draw.addFeatures([
{
type: "Feature",
properties: { mode: "polygon" },
geometry: {
type: "Polygon",
coordinates: [
[
[-0.135, 51.5105],
[-0.12, 51.5105],
[-0.12, 51.504],
[-0.135, 51.504],
[-0.135, 51.5105],
],
],
},
},
]);
// Click the map to draw another polygon; click its first point to close it.
draw.setMode("polygon");
},
} satisfies PluginDemo;Used by 3 products


GeoLens
Open-source, self-hosted catalog for geospatial data with semantic search, OGC APIs, and a map builder for composing and sharing multi-layer maps. Map editing and shared maps run on MapLibre GL JS.
GL JS · Web

Mountaya
Mapping platform for race organizers, athletes, coaches, and outdoor apps. Map Studio designs activity-aware routes and courses, and its embeddable interactive maps render with MapLibre GL JS.
GL JS · Web

Terrain Viewer
Free web tool for exploring, comparing, and exporting terrain visualizations such as hillshade, hypsometric tint, contours, slope, and sky-view factor over global and national elevation data. It is built on MapLibre GL JS with react-map-gl.
GL JS · Web