GeoJsonField

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.

Loading preview…

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.

Installation

import { GeoJsonField } from "@chelone/react/maps";

See the maps guide for the subpaths, the optional packages and MapsProvider.

Props

PropTypeDefaultDescription
classNamestring—
defaultValueunknown—Used when the property is `undefined`.
emptyTextstring—Replaces the translation of `chelone.map.no_geometry`.
fitBoundsboolean—Frame the map around the data. Defaults to true.
fitPaddingnumber—Pixels kept free around the fitted box. Defaults to 20.
heightstring | number—In pixels, or any CSS length. Defaults to 300.
mapStyleMapStyleInput—Defaults to the style from `MapsProvider`.
maxFitZoomnumber—The highest zoom a fit may reach, which also sets a single Point's zoom. Defaults to 18.
recordRecordType—Defaults to the ambient record.
scrollZoomboolean—Zoom with the mouse wheel. Defaults to false so the page still scrolls.
shapeStyleShapeStyle—Partial over `DEFAULT_SHAPE_STYLE`.
sourceSourceProp<RecordType>—The record property holding the GeoJSON value.