Convert the coordinate reference system, convert invalid geometry to valid
geometry with sf::st_make_valid(), and, optionally, erase water, and clean
names with janitor::clean_names().
Usage
format_md_sf(
data,
crs = getOption("mapmaryland.crs", default = 3857),
erase_water = FALSE,
erase_data = NULL,
clean_names = TRUE,
dTolerance = NULL,
smooth = FALSE,
sf_col = "geometry",
...
)Arguments
- data
A
sfobject or for (format_md_crash_data()only) a data.frame object.- crs
coordinate reference system. Defaults to
getOption("mapmaryland.crs", default = 3857). This option can be set withset_mapmaryland_options().- erase_water
If
TRUE, erase any geometry intersecting with md_water; Default:FALSE. IfTRUE, and erase_data is notNULL, md_water is combined and unioned with erase_data.- erase_data
A
sf,sfc, orbboxobject with geometry that should be erased from the data, Default:NULL- clean_names
If
TRUE, set .name_repair tojanitor::make_clean_names(); defaults toTRUE.- dTolerance
numeric; tolerance parameter, specified for all or for each feature geometry. If you run
st_simplify, the input data is specified with long-lat coordinates andsf_use_s2()returnsTRUE, then the value ofdTolerancemust be specified in meters.- smooth
If
TRUE, smooth data with smoothr::smooth using default method and parameters, Default:FALSE.- sf_col
Name to use for output
sfcolumn, Default: 'geometry'.- ...
Additional parameters passed to
format_data