Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

osm_poly2line

Convert osmdata polygons into lines


Description

Street networks downloaded with add_osm_object(key = "highway") will store any circular highways in osm_polygons. this function combines those with the osm_lines component to yield a single sf data.frame of all highways, whether polygonal or not.

Usage

osm_poly2line(osmdat)

Arguments

osmdat

An osmdata object.

Value

Modified version of same object with all osm_polygons objects merged into osm_lines.

Note

The osm_polygons field is retained, with those features also repeated as LINESTRING objects in osm_lines.

See Also

Examples

## Not run: 
dat <- opq ("colchester uk") %>%
    add_osm_feature (key = "highway") %>%
    osmdata_sf ()
# colchester has lots of roundabouts, and these are stored in 'osm_polygons'
# rather than 'osm_lines'. The former can be merged with the latter by:
dat2 <- osm_poly2line (dat)
# 'dat2' will have more lines than 'dat', but the same number of polygons
# (they are left unchanged.)

## End(Not run)

osmdata

Import 'OpenStreetMap' Data as Simple Features or Spatial Objects

v0.1.10
GPL-3
Authors
Mark Padgham [aut, cre], Bob Rudis [aut], Robin Lovelace [aut], Maëlle Salmon [aut], Andrew Smith [ctb], James Smith [ctb], Andrea Gilardi [ctb], Enrico Spinielli [ctb], Anthony North [ctb], Martin Machyna [ctb], Marcin Kalicinski [ctb, cph] (Author of included RapidXML code)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.