Skip to content

Improve documentation of weight_streetnet #245

@agila5

Description

@agila5

Hi @mpadge! I’ve created this issue since I would like to ask for better documentation regarding the behaviour of weight_streetnet. For example:

# packages
library(dodgr)
library(sf)
#> Linking to GEOS 3.11.2, GDAL 3.7.2, PROJ 9.3.0; sf_use_s2() is TRUE

# Just one segment
toy <- st_as_sf(
  data.frame(osm_id = 1, highway = "cycleway"), 
  geometry = st_sfc(
    st_linestring(rbind(c(0, 0), c(1, 1)))
  )
)
weight_streetnet(toy)[1:8]
#>   geom_num edge_id from_id from_lon from_lat to_id to_lon to_lat
#> 1        1       1       0        0        0     1      1      1
#> 2        1       2       1        1        1     0      0      0

Everything is fine! However, if I add a oneway field and set its value equal to “yes”, the function returns just one edge.

toy <- st_as_sf(
  data.frame(osm_id = 1, highway = "cycleway", oneway = "yes"), 
  geometry = st_sfc(
    st_linestring(rbind(c(0, 0), c(1, 1)))
  )
)
weight_streetnet(toy)[1:8]
#>   geom_num edge_id from_id from_lon from_lat to_id to_lon to_lat
#> 1        1       1       0        0        0     1      1      1

I totally understand (and I like!) this behaviour but, unfortunately, I think it’s a bit surprising. For example, I cannot find anywhere in the docs:

  1. which field names modify the behaviour of weight_streetnet?
  2. what are the possible values for these fields?

I think this information is crucial for users. Apologies for the noise if this is already documented somewhere, but I could find any reference.

Thanks!

Created on 2024-09-20 with reprex v2.0.2

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