
Draw and edit polygons on a map inside a DatoCMS JSON field. Editors click on an inline map to outline areas such as delivery zones, venues, neighborhoods, or campus boundaries. The field stores standard GeoJSON that any frontend can render.
The map uses MapLibre GL with OpenFreeMap tiles, so no API key or billing account is needed.

The demo draws a polygon point by point, drags a vertex, inserts a point on an edge, undoes a step, switches to the satellite basemap, imports coordinates, and fits the map to every shape. Watch the full-quality MP4.

FeatureCollection, Feature, Polygon, MultiPolygon, LineString), raw coordinate arrays, or one longitude, latitude pair per line, with a blank line between shapes.Scroll-wheel zoom needs Ctrl or ⌘ held down, and touch panning needs two fingers, so scrolling the record form never moves the map by accident.
The field saves a GeoJSON FeatureCollection of Polygon features:
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [-9.1508, 38.7105], [-9.1432, 38.7089], [-9.1368, 38.7118], [-9.1482, 38.7172], [-9.1508, 38.7105] ] ] } } ]}[longitude, latitude], as the GeoJSON spec requires.null.Because this is plain GeoJSON, you can pass it straight to MapLibre, Mapbox, Leaflet, Google Maps Data layers, Turf.js, or PostGIS.
https://plugins-cdn.datocms.com/datocms-plugin-geojson-polygons@latest/dist/index.html.Localized fields work too: each locale keeps its own polygons.
This project uses Node 22.12 or newer and pnpm 12, which you can enable with corepack enable.
pnpm install # also copies the MapLibre worker into public/pnpm dev # http://localhost:5173, add as a private plugin in DatoCMSpnpm check # oxlint (no warnings allowed), vitest, and the production buildMapLibre runs its tile parsing in a module worker. scripts/copy-maplibre-worker.mjs copies maplibre-gl-worker.mjs and maplibre-gl-shared.mjs from the maplibre-gl package into public/. Vite then ships them next to index.html, and the worker URL is resolved relative to the document, so it also works from the versioned plugin CDN.
datocms-react-ui 2.5Publishing a GitHub release runs .github/workflows/publish.yml, which checks the project and publishes it to npm with the NPM_TOKEN repository secret. DatoCMS picks up new versions for the Marketplace automatically.
The drawing, editing, and import logic is adapted from GeoJSON Polygon Builder, a standalone Next.js tool (live demo).