Map (Leaflet)

Interactive maps, markers, and geocoding with Leaflet.

Leaflet

Optional Leaflet-based map fields, form inputs, drawing/editing primitives, OSM utilities, and geocoding for Shadmin.

Leaflet OSM utilities

Hooks and pure helpers for querying OpenStreetMap data and performing geometric operations. Used by <OsmFeatureSubtract>, <OsmFeatureAdd>, and <LineStringInput snapToRoads>, and available for custom workflows.

MapWithSearch

A composite map input pairing a draggable Leaflet marker with an address-search combobox, kept in two-way sync.

GeocodingInput

Combobox-style address search input backed by Nominatim (or a custom provider). On selection, writes the display name to source and optionally writes latitude, longitude, and bbox to companion form fields.

ReverseGeocodeField

Read-only field that displays a human-readable address resolved from a lat/lng pair on the current record. Falls back to truncated coordinates while loading or when reverse geocoding returns no result.

BBoxField

Read-only Leaflet map that renders a GeoJSON.BBox ([west, south, east, north]) as a rectangular polygon stored at a record field.

BBoxInput

Form input for drawing an axis-aligned bounding box. The drawn rectangle is converted on save to a GeoJSON.BBox tuple ([west, south, east, north]), and existing bbox values are hydrated back into a rectangle layer for editing.

LatLngField

Read-only Leaflet map with a marker at the lat/lng pair read from the current record. Renders an empty-state panel when either coordinate is missing.

LatLngInput

Form input that renders a draggable Leaflet marker. Clicking the map or dragging the marker writes to two React Hook Form fields (latSource and lngSource).

PointField

Read-only Leaflet map that renders a GeoJSON.Point geometry stored at a record field.

PointInput

Form input for drawing a GeoJSON.Point. Renders a Geoman toolbar with the marker tool active.

MultiPointField

Read-only Leaflet map that renders a GeoJSON.MultiPoint geometry stored at a record field.

MultiPointInput

Form input for drawing a GeoJSON.MultiPoint. Each marker drawn is combined into a single MultiPoint value.

LineStringField

Read-only Leaflet map that renders a GeoJSON.LineString geometry stored at a record field.

LineStringInput

Form input for drawing a GeoJSON.LineString. Optionally snaps drawn lines to the OSM road network via OSRM.

MultiLineStringField

Read-only Leaflet map that renders a GeoJSON.MultiLineString geometry stored at a record field.

MultiLineStringInput

Form input for drawing a GeoJSON.MultiLineString. Each drawn polyline is combined into a single MultiLineString value.

PolygonField

Read-only Leaflet map that renders a GeoJSON.Polygon geometry stored at a record field.

PolygonInput

Form input for drawing a GeoJSON.Polygon. Renders a Geoman toolbar with the polygon and cut tools.

MultiPolygonField

Read-only Leaflet map that renders a GeoJSON.MultiPolygon geometry stored at a record field.

MultiPolygonInput

Form input for drawing a GeoJSON.MultiPolygon. Each drawn polygon is combined into a single MultiPolygon value.

GeometryCollectionField

Read-only Leaflet map that renders a GeoJSON.GeometryCollection (mixed point/line/polygon geometries) stored at a record field.

GeometryCollectionInput

Form input for drawing a GeoJSON.GeometryCollection. All drawn shapes are stored together as a single GeometryCollection value.

FeatureField

Read-only Leaflet map that renders a GeoJSON.Feature stored at a record field. Leaflet's L.geoJSON accepts Features directly, so this is a thin wrapper around the shared shape-field shell.

FeatureInput

Form input for drawing and editing a GeoJSON.Feature. Writes { type: "Feature", geometry, properties } to the form value; preserves properties across edits so attribute data isn't lost when the user reshapes the geometry.

FeatureCollectionField

Read-only Leaflet map that renders a GeoJSON.FeatureCollection stored at a record field. L.geoJSON renders the collection as a single multi-layer group — one layer per feature.

FeatureCollectionInput

Form input for drawing and editing a GeoJSON.FeatureCollection. Each drawn shape becomes a Feature in the collection; properties are carried forward from the previous form value by index on every edit.

GeoJSONField

Polymorphic read-only Leaflet field that renders any GeoJSON geometry (Point, LineString, Polygon, Multi\*, or GeometryCollection) stored at a record field.

GeoJSONInput

Polymorphic form input for drawing any GeoJSON geometry. Renders a Geoman toolbar with one button per allowed shape kind. Defaults to allowing Point, LineString, and Polygon.

OsmFeatureAdd

Form button that unions OSM features matching one or more typed presets (curated subsets like water, buildings, forest, roads, plus per-key category catch-alls like amenity, leisure, natural) and/or raw OSM tags (e.g. leisure=park) onto the polygon stored at a form field. Useful for extending a coverage region to include neighboring forest patches, lakes, or other features that the user wants part of the final area.

OsmFeatureSubtract

Form button that subtracts OSM features matching one or more typed presets (curated subsets like water, buildings, forest, roads, plus per-key category catch-alls like amenity, leisure, natural) and/or raw OSM tags (e.g. natural=water, building=*) from the polygon stored at a form field. Useful for trimming service areas to land, excluding building footprints, removing forested patches, or carving out major roads.

SimplifyInput

Form-aware control that simplifies a GeoJSON shape stored in the form value using @turf/simplify (Douglas-Peucker). Renders a Leaflet preview of the simplified result, a tolerance slider, and a quality toggle.

useGeomanRHF

Hook that bridges Geoman draw/edit/remove/cut events to a React Hook Form field. Manages a L.FeatureGroup that holds the in-progress geometry layers and serializes them back to GeoJSON on every change.