This function is used to explore the provider's databases and look for
patterns. This function can be useful in combination with oe_match()
and
oe_get()
for an easy match. See Examples.
Arguments
- pattern
Character string representing the pattern that should be explored.
- match_by
Column name of the provider's database that will be used to find the match.
- full_row
Boolean. Return all columns for the matching rows?
FALSE
by default.
Value
A list of character vectors or sf
objects (according to the value
of the parameter full_row
). If no OSM zone can be matched with the input
string, then the function returns an empty list.
Examples
oe_match_pattern("Yorkshire")
#> $geofabrik
#> [1] "East Yorkshire with Hull" "North Yorkshire"
#> [3] "South Yorkshire" "West Yorkshire"
#>
#> $openstreetmap_fr
#> [1] "Yorkshire And The Humber"
#>
res = oe_match_pattern("Yorkshire", full_row = TRUE)
lapply(res, function(x) sf::st_drop_geometry(x)[, 1:3])
#> $geofabrik
#> id name parent
#> 94 east-yorkshire-with-hull East Yorkshire with Hull england
#> 245 north-yorkshire North Yorkshire england
#> 315 south-yorkshire South Yorkshire england
#> 420 west-yorkshire West Yorkshire england
#>
#> $openstreetmap_fr
#> id name parent
#> 606 yorkshire_and_the_humber Yorkshire And The Humber england
#>
oe_match_pattern("ABC")
#> list()
oe_match_pattern("Yorkshire", match_by = "ABC")
#> list()