Get the roads of an area. Either by name of area (inPerioxi) or by bounding box (incoordinates).
osm.getRoads(
incoordinates = c(26.545029, 39.088569, 26.570177, 39.11681),
inPerioxi = "Mytilene Municipal Unit",
withBB = FALSE,
outcrs = 2100
)
Four coordinates of the bounding box.
Name of an area
Boolean indicating if we shall use a bounding box (incoordinates) or the name of an area (inPerioxi).
CRS of the the output
An sfnetwork
Other osm:
osm.ClipSFnetwork_with_poly()
,
osm.CreateEmptyRaster()
,
osm.bb_2_pol()
,
osm.combineAmenities()
,
osm.combineShops()
,
osm.getFrequency()
,
osm.getLength_footway()
,
osm.getPOI_usingbb()
,
osm.getPOI()
,
osm.osmdata_result_2_bbox_pol()
library(goal)
library(sf)
library(sfnetworks)
library(osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
mynetwork = osm.getRoads(incoordinates= c(26.545029,39.088569,26.570177,39.116810),
withBB=TRUE, outcrs=2100
)
#>
#> Using bbox
#> Warning: st_crs<- : replacing crs does not reproject data; use st_transform for that
#> Warning: st_crs<- : replacing crs does not reproject data; use st_transform for that
mynetwork
#> # A sfnetwork with 1011 nodes and 745 edges
#> #
#> # CRS: EPSG:2100
#> #
#> # An undirected multigraph with 283 components with spatially explicit edges
#> #
#> # A tibble: 1,011 × 1
#> geometry
#> <POINT [m]>
#> 1 (720570.8 4331266)
#> 2 (719927.1 4331309)
#> 3 (721299.6 4331289)
#> 4 (721287.5 4331404)
#> 5 (721245.2 4331235)
#> 6 (721069.4 4331400)
#> # ℹ 1,005 more rows
#> #
#> # A tibble: 745 × 6
#> from to osm_id name highway geometry
#> <int> <int> <chr> <chr> <chr> <LINESTRING [m]>
#> 1 1 2 39428970 Ζωοδόχου Πηγής primary (720570.8 4331266, 720530.6 43312…
#> 2 3 4 40847716 8ης Νοεμβρίου primary (721299.6 4331289, 721295.2 43313…
#> 3 3 5 40847725 NA primary (721245.2 4331235, 721248.1 43312…
#> # ℹ 742 more rows
mynetwork2 = osm.getRoads(inPerioxi="Mytilene Municipal Unit",
withBB=FALSE, outcrs=2100
)
#>
#> Using name of area
#> Warning: st_crs<- : replacing crs does not reproject data; use st_transform for that
#> Warning: st_crs<- : replacing crs does not reproject data; use st_transform for that
mynetwork2
#> # A sfnetwork with 2536 nodes and 1799 edges
#> #
#> # CRS: EPSG:2100
#> #
#> # An undirected multigraph with 775 components with spatially explicit edges
#> #
#> # A tibble: 2,536 × 1
#> geometry
#> <POINT [m]>
#> 1 (720570.8 4331266)
#> 2 (719927.1 4331309)
#> 3 (721299.6 4331289)
#> 4 (721287.5 4331404)
#> 5 (721245.2 4331235)
#> 6 (721069.4 4331400)
#> # ℹ 2,530 more rows
#> #
#> # A tibble: 1,799 × 6
#> from to osm_id name highway geometry
#> <int> <int> <chr> <chr> <chr> <LINESTRING [m]>
#> 1 1 2 39428970 Ζωοδόχου Πηγής primary (720570.8 4331266, 720530.6 43312…
#> 2 3 4 40847716 8ης Νοεμβρίου primary (721299.6 4331289, 721295.2 43313…
#> 3 3 5 40847725 NA primary (721245.2 4331235, 721248.1 43312…
#> # ℹ 1,796 more rows