Maps
Maps for showing and drawing GeoJSON, over the services you set.
Fields
Shows a GeoJSON Geometry, Feature or FeatureCollection from a record on a map, framed to fit it. A null, a string, a number or a malformed object shows a text panel in its place: a string that holds JSON text is never parsed. The named fields (PointField, PolygonField, ...) are this component.
Shows a BBox value from a record, [west, south, east, north], as a rectangle on a map. A value that is not four finite numbers shows the empty text panel. It is GeoJsonField over a box, so it takes the same props.
Shows a point held in two record fields, latSource and lngSource, as a marker on a map centred on it. A missing, null, non-numeric or out-of-range coordinate shows a text panel in its place; 0 is a position.
Shape fields
One field per GeoJSON type, each GeoJsonField under another name: PointField, MultiPointField, LineStringField, MultiLineStringField, PolygonField, MultiPolygonField, GeometryCollectionField, FeatureField and FeatureCollectionField. They exist so an app migrating from shadmin changes no import.
Shows a GeoJSON Point from a record on a map as a circle marker, zoomed to maxFitZoom, 18 by default. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Shows a GeoJSON MultiPoint from a record on a map, one circle per coordinate. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Shows a GeoJSON LineString from a record on a map as a line 3 pixels wide, which shapeStyle restyles. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Shows a GeoJSON MultiLineString from a record on a map, one line per part. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Shows a GeoJSON Polygon from a record on a map, filled at 0.2 opacity and outlined 3 pixels wide, both through shapeStyle. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Shows a GeoJSON MultiPolygon from a record on a map, one filled part per polygon. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Shows a GeoJSON GeometryCollection from a record on a map, drawing each geometry by its own type. A collection with no coordinates shows the empty text panel. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Shows the geometry of a GeoJSON Feature from a record on a map. Its properties are not rendered. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Shows every geometry of a GeoJSON FeatureCollection from a record on a map. A feature with a null geometry is left out. It is GeoJsonField under the name of a GeoJSON type, so it takes the same props.
Inputs
Edits a GeoJSON value in a form field by drawing on a map: kind says what the field holds and picks the tools the toolbar shows. Each finished drawing, vertex drag, move or removal is written to the field, and a part the editor cannot hold shows read-only and stays in the value. The named inputs (PointInput, PolygonInput, ...) are this component with kind and tools set for you.
Edits a BBox value, [west, south, east, north], by drawing a rectangle with draw-rectangle, edit, move and delete. A new rectangle replaces the old one, and aspectRatio grows the stored box around its centre to that width over height. It is ShapeInput with kind and tools set for you, so its table holds neither.
Edits a latitude and a longitude held in two form fields, latSource and lngSource, by typing or by clicking a map. A click or a pin drag writes both fields rounded to 6 decimals and calls onPositionChange; typing never calls it.
Thins a stored GeoJSON value with a tolerance slider and previews the result on a map: the form holds the simplified value. Every change simplifies from the first value, so sliding back to minTolerance restores it. quality picks the algorithm, High keeping more detail. A null value shows an empty state, and any other value than GeoJSON or null throws.
Shape inputs
Edits a GeoJSON Point by drawing on a map with draw-point, move and delete. A new point replaces the old one. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits a GeoJSON MultiPoint by drawing on a map with draw-point, edit, move and delete. Each point is its own feature on the map. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits a GeoJSON LineString by drawing on a map with draw-line, edit, move and delete. A new line replaces the old one. snapToRoads snaps each drawn or edited line to the road network through the MapsProvider router, and throws when there is none. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits a GeoJSON MultiLineString by drawing on a map with draw-line, edit, move and delete. Each line is its own feature on the map. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits a GeoJSON Polygon by drawing on a map with draw-polygon, draw-rectangle, draw-circle, cut, edit, move and delete. A new drawing replaces the old one. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits a GeoJSON MultiPolygon with the tools of PolygonInput. Each part is its own feature on the map, and a part with a hole draws read-only and stays in the value. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits a GeoJSON GeometryCollection with every draw tool, then cut, edit, move and delete. Every shape stays in the value. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits any one GeoJSON geometry, or with collection a GeometryCollection, limited to the shapes the user may draw, all three by default. Without collection a new drawing replaces the old one. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits a GeoJSON Feature with the tools of its shape, Polygon by default. An edit keeps the feature's id and properties. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Edits a GeoJSON FeatureCollection with the tools of its allowedShapes, Point, LineString and Polygon by default. Each feature keeps its own properties when another is removed. It is ShapeInput under the name of a GeoJSON type, with kind set for you.
Geocoding and OpenStreetMap
Searches an address with a geocoding provider and writes the result the user picks to the form: its name to source, its latitude to latSource, its longitude to lngSource and its box to bboxSource, when the result has one. A provider that allows typeahead searches as the user types, after debounceMs; any other searches on Enter or on the Search button. Text typed by hand is saved when the field loses focus and clears latSource, lngSource and bboxSource, so they never describe a different address. Needs a provider, from provider or MapsProvider.
An address search over a map: a <GeocodingInput> on addressSource above a map with a pin on latSource and lngSource. Picking a result fills all three fields and moves the pin. Clicking the map or dragging the pin writes the address of that spot, unless the service finds none, and the lookup runs only after such a gesture, never on mount and never after a pick, so a picked address is never overwritten. Needs the optional maplibre-gl peer.
Names the position held in two record fields, latSource and lngSource, as an address read from a geocoding provider. format keeps the whole name, or shortens it to its first part with street or to its first two with city. Renders nothing when either field is not a number or a numeric string, a skeleton while the lookup runs, and the coordinates to 4 decimals when the provider knows no place. Needs a provider, from provider or MapsProvider.
A button that edits the Polygon or MultiPolygon held in source with OpenStreetMap areas queried from Overpass by presets and tags: mode subtract removes them and add merges them in. The request runs on the click, and the result is written like a user edit, so the form turns dirty and the field's validators run. A cut or merge that would leave a Polygon as several pieces is refused with a warning and the value is left as it was. Needs an Overpass provider, from provider or MapsProvider. OsmFeatureAdd and OsmFeatureSubtract are this component with mode set for you.
A button that merges OpenStreetMap areas into the Polygon or MultiPolygon held in source, queried from Overpass by presets and tags. The request runs on the click, and the result is written like a user edit, so the form turns dirty and the field's validators run. A merge that would leave a Polygon as several pieces is refused with a warning and the value is left as it was. Needs an Overpass provider, from provider or MapsProvider. It is OsmFeatureOperator with mode set to add for you.
A button that removes OpenStreetMap areas, such as the water in a delivery area, from the Polygon or MultiPolygon held in source, queried from Overpass by presets and tags. The request runs on the click, and the result is written like a user edit, so the form turns dirty and the field's validators run. Areas that cover the value entirely clear the field to null, and a cut that would leave a Polygon as several pieces is refused with a warning and the value is left as it was. Needs an Overpass provider, from provider or MapsProvider. It is OsmFeatureOperator with mode set to subtract for you.