Learn R Programming

osmplotr (version 0.1-2)

highways2polygon: highways2polygon

Description

Takes a list of highways names which must enclose an internal area, and returns a SpatialLines object containing a sequence of OSM nodes which cyclically connect all highways. Will fail if the streets do not form a cycle.

Usage

highways2polygon(highways = NULL, bbox = NULL, plot = FALSE)

Arguments

highways
A vector of highway names passed directly to the Overpass API. Wildcards and whitespaces are '.'; for other options see online help for the overpass API.
bbox
The bounding box within which to look for highways. Must be a vector of 4 elements (xmin, ymin, xmax, ymax).
plot
If TRUE, then all OSM data for each highway is plotted and the final cycle overlaid.

Value

  • A single data.frame containing the lat-lon coordinates of the cyclic line connecting all given streets.