OsmFeatureOperator

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.

Loading preview…

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.

Installation

import { OsmFeatureOperator } from "@chelone/react/maps/osm";

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

Props

PropTypeDefaultDescription
classNamestring—
disabledboolean—
iconReactNode—
labelReactNode—The button text. A string is translated. Defaults to the mode's message.
mode"subtract" | "add"—`subtract` removes the matching OSM areas from the polygon; `add` merges them in.
presetsreadonly "water" | "natural" | "waterway" | "building" | "forest" | "landuse" | "roads" | "highway" | "amenity" | "leisure" | "boundary" | "place" | "man_made" | "shop" | "tourism" | "historic" | "railway" | "barrier" | "power" | "buildings"[]—Named OSM feature sets to query, such as `water`.
providerOverpassProvider—Defaults to the `overpass` of `MapsProvider`. One of the two is required.
sourceSourceProp<TRecord>—The form field holding the Polygon or MultiPolygon.
tagsreadonly templateLiteral[]—Extra Overpass tag filters, such as `natural=wood`.