Closed agila5 closed 2 years ago
First implementation of oe_get_bounday. Fix #206.
oe_get_bounday
Some examples. First, load packages
library(osmextract) #> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright. #> Check the package website, https://docs.ropensci.org/osmextract/, for more details. library(sf) #> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 7.2.1; sf_use_s2() is TRUE
Basic example
iow <- oe_get_boundary("Isle of Wight", quiet = TRUE) plot(st_geometry(iow))
All administrative regions
oe_get_boundary("Isle of Wight", name = "%", exact = FALSE, quiet = TRUE)[, 1:3] #> Simple feature collection with 34 features and 3 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY #> Bounding box: xmin: -1.591801 ymin: 50.57468 xmax: -1.062719 ymax: 50.76756 #> Geodetic CRS: WGS 84 #> First 10 features: #> osm_id osm_way_id name geometry #> 1 154350 <NA> Isle of Wight MULTIPOLYGON (((-1.086357 5... #> 2 214494 <NA> Bembridge MULTIPOLYGON (((-1.101696 5... #> 3 910850 <NA> Calbourne MULTIPOLYGON (((-1.445158 5... #> 4 910851 <NA> Cowes MULTIPOLYGON (((-1.300432 5... #> 5 910852 <NA> Newport MULTIPOLYGON (((-1.25449 50... #> 6 910859 <NA> Brading MULTIPOLYGON (((-1.176043 5... #> 7 910914 <NA> Freshwater MULTIPOLYGON (((-1.53881 50... #> 8 910917 <NA> Yarmouth MULTIPOLYGON (((-1.50084 50... #> 9 910918 <NA> Shalfleet MULTIPOLYGON (((-1.445158 5... #> 10 911503 <NA> Shanklin MULTIPOLYGON (((-1.213082 5...
Unfortunately, this does not always work
oe_get_boundary("Leeds", quiet = TRUE) #> Simple feature collection with 0 features and 25 fields #> Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA #> Geodetic CRS: WGS 84 #> [1] osm_id osm_way_id name type aeroway amenity #> [7] admin_level barrier boundary building craft geological #> [13] historic land_area landuse leisure man_made military #> [19] natural office place shop sport tourism #> [25] other_tags geometry #> <0 rows> (or 0-length row.names)
We may need slightly different approaches
leeds <- oe_get_boundary("West Yorkshire", "Leeds", quiet = TRUE) plot(st_geometry(leeds))
Created on 2022-08-17 by the reprex package (v2.0.1)
This looks like it will be v. useful.
First implementation of
oe_get_bounday
. Fix #206.Some examples. First, load packages
Basic example
All administrative regions
Unfortunately, this does not always work
We may need slightly different approaches
Created on 2022-08-17 by the reprex package (v2.0.1)