-
Notifications
You must be signed in to change notification settings - Fork 17
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
Edge map order is wrong #173
Comments
The above commit just changed the library (dodgr)
packageVersion ("dodgr")
#> [1] '0.2.12.22'
f <- "/<path>/<to>/bristol-sc.Rds"
net <- readRDS (f) |>
weight_streetnet (wt_profile = "motorcar")
#> Loading required namespace: geodist
#> Loading required namespace: dplyr
netc <- dodgr_contract_graph (net)
h <- attr (netc, "hashc")
f <- list.files (tempdir (), full.names = TRUE,
pattern = paste0 ("edge\\_map\\_", h))
edge_map <- readRDS (f)
n <- dplyr::group_by (edge_map, edge_new) |>
dplyr::summarise (n = dplyr::n ()) |>
dplyr::arrange (by = dplyr::desc (n))
edge_old <- edge_map$edge_old [which (edge_map$edge_new == n$edge_new [1])]
g <- net [match (edge_old, net$edge_), ]
plot (g$.vx0_x, g$.vx0_y, type = "l") Created on 2021-11-26 by the reprex package (v2.0.1.9000) |
Re-opening because the result is not quite what it should be: library (dodgr)
packageVersion ("dodgr")
#> [1] '0.2.12.22'
f <- "/data/mega/code/repos/atfutures-labs/neighbourhoods/bristol-sc.Rds"
net <- readRDS (f) |>
weight_streetnet (wt_profile = "motorcar")
#> Loading required namespace: geodist
#> Loading required namespace: dplyr
netc <- dodgr_contract_graph (net)
h <- attr (netc, "hashc")
f <- list.files (tempdir (), full.names = TRUE,
pattern = paste0 ("edge\\_map\\_", h))
edge_map <- readRDS (f)
n <- dplyr::group_by (edge_map, edge_new) |>
dplyr::summarise (n = dplyr::n ()) |>
dplyr::arrange (by = dplyr::desc (n))
edge_old <- edge_map$edge_old [which (edge_map$edge_new == n$edge_new [1])]
g <- net [match (edge_old, net$edge_), ]
par (mfrow = c (1, 2))
plot (g$.vx0_x, g$.vx0_y, type = "l")
obj <- unique (net$object_ [match (g$edge_, net$edge_)])
g2 <- net [which (net$object_ %in% obj), ]
plot (g2$.vx0_x, g2$.vx0_y, type = "l") Created on 2021-11-26 by the reprex package (v2.0.1.9000) The re-constructed edges still have a couple of glitches in them. |
All good now: library (dodgr)
packageVersion ("dodgr")
#> [1] '0.2.12.24'
f <- "/<path>/<to>/bristol-sc.Rds"
graph <- x <- readRDS (f) |>
weight_streetnet (wt_profile = "motorcar")
#> Loading required namespace: geodist
#> Loading required namespace: dplyr
v <- dodgr_vertices (graph)
verts <- NULL
graph_contracted <- dodgr_contract_graph_internal (graph, v, verts)
edge_map <- graph_contracted$edge_map
n <- dplyr::group_by (edge_map, edge_new) |>
dplyr::summarise (n = dplyr::n ()) |>
dplyr::arrange (by = dplyr::desc (n))
edge_old <- edge_map$edge_old [which (edge_map$edge_new == n$edge_new [1])]
g <- graph [match (edge_old, graph$edge_), ]
par (mfrow = c (1, 2))
plot (g$.vx0_x, g$.vx0_y, type = "l")
obj <- unique (graph$object_ [match (g$edge_, graph$edge_)])
g2 <- graph [which (graph$object_ %in% obj), ]
plot (g2$.vx0_x, g2$.vx0_y, type = "l") Created on 2021-11-29 by the reprex package (v2.0.1.9000) |
The
neighbourhoods
package needs to uncontract edges, for which it uses the cached edge maps. The order of these is, however, all mucked up, and so can't be used in current form to directly uncontract the edges:Created on 2021-11-26 by the reprex package (v2.0.1.9000)
The text was updated successfully, but these errors were encountered: