Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update weightstreetnet docs to fix #245 #251

Merged
merged 9 commits into from
Sep 30, 2024
Merged

update weightstreetnet docs to fix #245 #251

merged 9 commits into from
Sep 30, 2024

Conversation

mpadge
Copy link
Member

@mpadge mpadge commented Sep 26, 2024

No description provided.

R/weight-streetnet.R Outdated Show resolved Hide resolved
R/weight-streetnet.R Outdated Show resolved Hide resolved
R/weight-streetnet.R Outdated Show resolved Hide resolved
R/weight-streetnet.R Outdated Show resolved Hide resolved
R/weight-streetnet.R Outdated Show resolved Hide resolved
R/weight-streetnet.R Outdated Show resolved Hide resolved
@mpadge mpadge requested a review from agila5 September 27, 2024 09:16
@mpadge
Copy link
Member Author

mpadge commented Sep 27, 2024

@agila5 Thanks for your excellent feedback. I've now largely rewritten the whole thing again. Would you please be kind enough to review it once again? Thanks!

@mpadge mpadge merged commit b4eb348 into main Sep 30, 2024
6 checks passed
@mpadge mpadge deleted the oneway branch September 30, 2024 07:54
@agila5
Copy link
Contributor

agila5 commented Sep 30, 2024

Hi @mpadge and sorry for the delay. I've been very busy the last days. I'll review it right now!

#' key-value pairs defined in the underlying OpenStreetMap (OSM) data.
#'
#' Many key-value pairs influence the resultant network through being used in
#' specified weighting profiles. Keys used in weighting profiles are always
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one very minor thing I don't understand. This part of text means that if OSM data includes a column named bridleway, cycleway, ... and that weighting profile is included in the corresponding mode of transport, that column is always retained in the output object, right?

I don't understand the following then:

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

# The default mode of transport is "bicycle" which contains the following
# highway types:
weighting_profiles$weighting_profiles[67:88, "way"]
#>  [1] "motorway"       "trunk"          "primary"        "secondary"     
#>  [5] "tertiary"       "unclassified"   "residential"    "service"       
#>  [9] "track"          "cycleway"       "path"           "steps"         
#> [13] "ferry"          "living_street"  "bridleway"      "footway"       
#> [17] "pedestrian"     "motorway_link"  "trunk_link"     "primary_link"  
#> [21] "secondary_link" "tertiary_link"

# For example
toy <- st_as_sf(
  data.frame(highway = "primary", cycleway = c("A", "B"), osm_id = 1:2), 
  geometry = st_sfc(
    st_linestring(rbind(c(0, 0), c(1, 1))), 
    st_linestring(rbind(c(1, 1), c(2, 2)))
  )
)
weight_streetnet(toy) # cycleway is retained
#>   geom_num edge_id from_id from_lon from_lat to_id to_lon to_lat        d
#> 1        1       1       0        0        0     1      1      1 156899.6
#> 2        1       2       1        1        1     0      0      0 156899.6
#> 3        2       3       1        1        1     2      2      2 156876.1
#> 4        2       4       2        2        2     1      1      1 156876.1
#>   d_weighted highway way_id component cycleway     time time_weighted
#> 1   224142.2 primary      1         1        A 37655.90      53794.14
#> 2   224142.2 primary      1         1        A 37655.90      53794.14
#> 3   224108.8 primary      2         1        B 37650.28      53786.11
#> 4   224108.8 primary      2         1        B 37650.28      53786.11

# Same structure but considering 
toy <- st_as_sf(
  data.frame(highway = "primary", path = c("A", "B"), osm_id = 1:2), 
  geometry = st_sfc(
    st_linestring(rbind(c(0, 0), c(1, 1))), 
    st_linestring(rbind(c(1, 1), c(2, 2)))
  )
)
weight_streetnet(toy) # path is not retained
#>   geom_num edge_id from_id from_lon from_lat to_id to_lon to_lat        d
#> 1        1       1       0        0        0     1      1      1 156899.6
#> 2        1       2       1        1        1     0      0      0 156899.6
#> 3        2       3       1        1        1     2      2      2 156876.1
#> 4        2       4       2        2        2     1      1      1 156876.1
#>   d_weighted highway way_id component     time time_weighted
#> 1   224142.2 primary      1         1 37655.90      53794.14
#> 2   224142.2 primary      1         1 37655.90      53794.14
#> 3   224108.8 primary      2         1 37650.28      53786.11
#> 4   224108.8 primary      2         1 37650.28      53786.11

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants