Skip to content

[FEATURE] Better documentation and maybe support for relations #265

Description

@Robinlovelace

It would be nice to get all features associated with a particular relation, e.g. network=ncn.

Reprex below may illustrate this better, one to talk about and test things out @agila5 but, for now, do you see broadly what I mean?

# Aim: get UK's national cycle network

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.

# Test on a small amount of data
query = "SELECT * FROM 'lines' WHERE ncn = 'yes'"
et = c("oneway", "maxspeed", "ref", "ncn")
cycleways_wyca = oe_get(place = "West Yorkshire", query = query, extra_tags = et)
#> The input place was matched with: West Yorkshire
#> The chosen file was already detected in the download directory. Skip downloading.
#> The corresponding gpkg file was already detected. Skip vectortranslate operations.
#> Reading query `SELECT * FROM 'lines' WHERE ncn = 'yes'' from data source `/mnt/57982e2a-2874-4246-a6fe-115c199bc6bd/data/osm/geofabrik_west-yorkshire-latest.gpkg' 
#>   using driver `GPKG'
#> Simple feature collection with 24 features and 14 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -2.126027 ymin: 53.66803 xmax: -1.345368 ymax: 53.87748
#> Geodetic CRS:  WGS 84
nrow(cycleways_wyca) # 24 rows
#> [1] 24
mapview::mapview(cycleways_wyca)

query = "SELECT * FROM 'multilinestrings' WHERE ncn is not null OR network = 'ncn'"
et = c("oneway", "maxspeed", "ref", "ncn", "network")
cycleways_wyca_relations = oe_get(place = "West Yorkshire", query = query, extra_tags = et)
#> The input place was matched with: West Yorkshire
#> Warning: The query selected a layer which is different from layer argument. We
#> will replace the layer argument.
#> The chosen file was already detected in the download directory. Skip downloading.
#> The corresponding gpkg file was already detected. Skip vectortranslate operations.
#> Reading query `SELECT * FROM 'multilinestrings' WHERE ncn is not null OR network = 'ncn'' from data source `/mnt/57982e2a-2874-4246-a6fe-115c199bc6bd/data/osm/geofabrik_west-yorkshire-latest.gpkg' 
#>   using driver `GPKG'
#> Simple feature collection with 15 features and 9 fields
#> Geometry type: MULTILINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -2.156127 ymin: 53.5308 xmax: -1.313181 ymax: 53.95098
#> Geodetic CRS:  WGS 84
nrow(cycleways_wyca_relations) # 27 rows
#> [1] 15
mapview::mapview(cycleways_wyca_relations)

# How to get the results above as individual lines?
# wyca_relations = oe_get(place = "West Yorkshire", ...)

Created on 2022-08-19 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions