crop {cartographr} | R Documentation |
This function crops an OpenStreetMap (OSM) object that has been preprocessed. It supports different types of geometric boundaries such as rectangles, circles, and hexagons, or a custom boundary provided as an 'sf' object.
crop(osm, boundary = "rect")
osm |
A preprocessed OSM object to which the crop will be applied. |
boundary |
The type of geometric boundary to apply to the OSM data. Can be "rect" for a rectangular boundary, "circle" for a circular boundary, "hex" for a hexagonal boundary, or an 'sf' object for a custom boundary. Default is "rect". |
If the OSM object has not been preprocessed, the function will call preprocess_map()
to preprocess the data before applying the cropping. The type of preprocessing applied
is stored in the OSM object's metadata.
The OSM object with the specified geometric crop applied.
data("osm")
# Apply a circular crop
osm_circle_cropped <- osm |> crop(boundary = "circle")