R package for downloading OpenStreetMap data
1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/unique-osmdata.R
3\name{unique_osmdata}
4\alias{unique_osmdata}
5\title{unique_osmdata}
6\usage{
7unique_osmdata(dat)
8}
9\arguments{
10\item{dat}{An object of class \code{osmdata_sf} or \code{osmdata_sp}}
11}
12\value{
13Equivalent object reduced to only unique objects of each type
14}
15\description{
16Reduce the components of an \link{osmdata} object in 'sf' or 'sp' form (that
17is, obtained from \code{\link[=osmdata_sf]{osmdata_sf()}} or \code{\link[=osmdata_sp]{osmdata_sp()}} to only unique
18items of each type. That is, reduce \verb{$osm_points} to only those points not
19present in other objects (lines, polygons, etc.); reduce \verb{$osm_lines} to
20only those lines not present in multiline objects; and reduce
21\verb{$osm_polygons} to only those polygons not present in multipolygon
22objects. This renders an \link{osmdata} object more directly compatible with
23typical output of \pkg{sf}.
24}
25\examples{
26\dontrun{
27query <- opq ("colchester uk") |>
28 add_osm_feature (key = "highway")
29# Then extract data from 'Overpass' API
30dat <- osmdata_sf (query)
31dat
32# Then reduce to unique items of each type only:
33dat <- unique_osmdata (dat)
34dat
35}
36# And objects of each type (points, line, polygons, and so on) now have
37# fewer members.
38}
39\seealso{
40Other transform:
41\code{\link{osm_elevation}()},
42\code{\link{osm_poly2line}()},
43\code{\link{trim_osmdata}()},
44\code{\link{unname_osmdata_sf}()}
45}
46\concept{transform}