Reduce the components of an osmdata object in 'sf' or 'sp' form (that
is, obtained from osmdata_sf or osmdata_sp) to only unique
items of each type. That is, reduce $osm_points
to only those points not
present in other objects (lines, polygons, etc.); reduce $osm_lines
to
only those lines not present in multiline objects; and reduce
$osm_polygons
to only those polygons not present in multipolygon
objects. This renders an osmdata object more directly compatible with
typical output of sf.
Arguments
- dat
An osmdata object
See also
Other transform:
osm_elevation()
,
osm_poly2line()
,
trim_osmdata()
,
unname_osmdata_sf()
Examples
# Bounding box of "Colchester UK":
bb <- c (0.6993788, 51.7657055, 1.026803, 51.977153)
query <- opq (bb)
query <- add_osm_feature (query, key = "highway")
# Equivalent to:
if (FALSE) { # \dontrun{
query <- opq ("colchester uk") |>
add_osm_feature (key = "highway")
} # }
# Then extract data from 'Overpass' API
if (FALSE) { # \dontrun{
dat <- osmdata_sf (query)
dat
} # }
# Then reduce to unique items of each type only:
if (FALSE) { # \dontrun{
dat <- unique_osmdata (dat)
dat
} # }
# And objects of each type (points, line, polygons, and so on) now have
# fewer members.