A Netlify CMS widget that allows drawing points, lines, and polygons. This is still in very early stages.
As an npm package:
npm install --save netlify-cms-widget-geojson
import geojson from 'netlify-cms-widget-geojson'
CMS.registerWidget('geojson', GeoControl, GeoPreview)
Via script
tag:
<script src="https://unpkg.com/netlify-cms-widget-geojson@^0.0.3"></script>
<script>
CMS.registerWidget('geojson', GeoControl, GeoPreview)
</script>
Add to your Netlify CMS configuration:
fields:
- {label: "Geometry", name: "geojson", widget: geojson, draw: 'polygon', single: false, lat: 0, lng: 0, zoom: 1 }
draw
: Sets the type of geometry you can draw. Options:marker
,polyline
, andpolygon
. Remove property if you want to be able to draw all types.single
: Default:false
. Set totrue
to limit the user to drawing one feature.lat
,lng
,zoom
: Set the default position for the map.