{"action":"created","issue":{"url":"https://api.github.com/repos/ATFutures/dodgr/issues/31","repository_url":"https://api.github.com/repos/ATFutures/dodgr","labels_url":"https://api.github.com/repos/ATFutures/dodgr/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/ATFutures/dodgr/issues/31/comments","events_url":"https://api.github.com/repos/ATFutures/dodgr/issues/31/events","html_url":"https://github.com/ATFutures/dodgr/issues/31","id":280139316,"number":31,"title":"Enable dodgr to create route networks with total values aggregated from variables at the OD level","user":{"login":"Robinlovelace","id":1825120,"avatar_url":"https://avatars2.githubusercontent.com/u/1825120?v=4","gravatar_id":"","url":"https://api.github.com/users/Robinlovelace","html_url":"https://github.com/Robinlovelace","followers_url":"https://api.github.com/users/Robinlovelace/followers","following_url":"https://api.github.com/users/Robinlovelace/following{/other_user}","gists_url":"https://api.github.com/users/Robinlovelace/gists{/gist_id}","starred_url":"https://api.github.com/users/Robinlovelace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Robinlovelace/subscriptions","organizations_url":"https://api.github.com/users/Robinlovelace/orgs","repos_url":"https://api.github.com/users/Robinlovelace/repos","events_url":"https://api.github.com/users/Robinlovelace/events{/privacy}","received_events_url":"https://api.github.com/users/Robinlovelace/received_events","type":"User","site_admin":false},"labels":[{"id":654424381,"url":"https://api.github.com/repos/ATFutures/dodgr/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":{"login":"mpadge","id":6697851,"avatar_url":"https://avatars1.githubusercontent.com/u/6697851?v=4","gravatar_id":"","url":"https://api.github.com/users/mpadge","html_url":"https://github.com/mpadge","followers_url":"https://api.github.com/users/mpadge/followers","following_url":"https://api.github.com/users/mpadge/following{/other_user}","gists_url":"https://api.github.com/users/mpadge/gists{/gist_id}","starred_url":"https://api.github.com/users/mpadge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpadge/subscriptions","organizations_url":"https://api.github.com/users/mpadge/orgs","repos_url":"https://api.github.com/users/mpadge/repos","events_url":"https://api.github.com/users/mpadge/events{/privacy}","received_events_url":"https://api.github.com/users/mpadge/received_events","type":"User","site_admin":false},"assignees":[{"login":"mpadge","id":6697851,"avatar_url":"https://avatars1.githubusercontent.com/u/6697851?v=4","gravatar_id":"","url":"https://api.github.com/users/mpadge","html_url":"https://github.com/mpadge","followers_url":"https://api.github.com/users/mpadge/followers","following_url":"https://api.github.com/users/mpadge/following{/other_user}","gists_url":"https://api.github.com/users/mpadge/gists{/gist_id}","starred_url":"https://api.github.com/users/mpadge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpadge/subscriptions","organizations_url":"https://api.github.com/users/mpadge/orgs","repos_url":"https://api.github.com/users/mpadge/repos","events_url":"https://api.github.com/users/mpadge/events{/privacy}","received_events_url":"https://api.github.com/users/mpadge/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2017-12-07T13:58:35Z","updated_at":"2018-03-05T21:01:16Z","closed_at":null,"author_association":"CONTRIBUTOR","body":""},"comment":{"url":"https://api.github.com/repos/ATFutures/dodgr/issues/comments/370563973","html_url":"https://github.com/ATFutures/dodgr/issues/31#issuecomment-370563973","issue_url":"https://api.github.com/repos/ATFutures/dodgr/issues/31","id":370563973,"user":{"login":"mpadge","id":6697851,"avatar_url":"https://avatars1.githubusercontent.com/u/6697851?v=4","gravatar_id":"","url":"https://api.github.com/users/mpadge","html_url":"https://github.com/mpadge","followers_url":"https://api.github.com/users/mpadge/followers","following_url":"https://api.github.com/users/mpadge/following{/other_user}","gists_url":"https://api.github.com/users/mpadge/gists{/gist_id}","starred_url":"https://api.github.com/users/mpadge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpadge/subscriptions","organizations_url":"https://api.github.com/users/mpadge/orgs","repos_url":"https://api.github.com/users/mpadge/repos","events_url":"https://api.github.com/users/mpadge/events{/privacy}","received_events_url":"https://api.github.com/users/mpadge/received_events","type":"User","site_admin":false},"created_at":"2018-03-05T21:01:16Z","updated_at":"2018-03-05T21:01:16Z","author_association":"COLLABORATOR","body":"That last plot was a bosh job from made-up coordinates taken as mid-points of the lines. Then i realised the actual coordinates were all in `stplanr::cents_sf`, so real code that directly compares the 2 approaches looks like this:\r\n```\r\nlibrary(dodgr)\r\nlibrary(stplanr)\r\nlibrary(sf)\r\n\r\n#  route via stplanr:\r\nl = od2line(flow[1:10, 1:3], cents_sf)\r\nr = line2route(l, route_fun = route_osrm)\r\nr$value = 1:nrow(r)\r\nrnet = overline(r, attrib = \"value\")\r\nr$highway = \"cycleway\"\r\ng = weight_streetnet(r, keep_cols = \"value\")\r\nrnet_dodgr = dodgr_flows_aggregate (g, flows = g$value) %>%\r\n    merge_directed_flows ()\r\npar (mfrow=c(1,2))\r\ndodgr_flowmap (rnet_dodgr, linescale = 10)\r\npoints (pts, pch = 19, cex = 3, col = \"blue\")\r\n\r\n# route via dodgr:\r\npts <- st_coordinates (cents_sf$geometry)\r\nfmat <- array (NA, dim = rep (nrow (pts), 2))\r\nindx1 <- match (flow$Area.of.residence, cents_sf$geo_code)\r\nindx2 <- match (flow$Area.of.workplace, cents_sf$geo_code)\r\nfmat [(indx2 - 1) * nrow (fmat) + indx1] <- flow$All\r\n\r\n# Get street network via `osmdata`\r\nnet <- dodgr_streetnet (pts = pts, expand = 0.2) %>%\r\n    weight_streetnet (wt_profile = \"bicycle\") # or whatever\r\nverts <- dodgr_vertices (net)\r\nids <- verts$id [match_pts_to_graph (verts, pts)]\r\ng <- dodgr_flows_aggregate (net, from = ids, to = ids, flows = fmat) %>%\r\n    merge_directed_flows ()\r\n\r\ndodgr_flowmap (g, linescale = 10)\r\npoints (pts, pch = 19, cex = 3, col = \"blue\")\r\n```\r\n![junk](https://user-images.githubusercontent.com/6697851/36999343-1ad33526-20c0-11e8-84e0-e2cbe1a6ad65.png)\r\n\r\nConcentrating for example on flows between the southern- and easternmost points reveals that the `stplanr` code sends those flows first way up north before curving back down south to reach the easternmost point. The `dodgr` code flows through several paths, including two that are definitely more direct. `dodgr` simply returns far more paths than the `stplanr` code, which only routes through a network of 10 items in total (that is, shortest paths are routed through aggregated linestring objects, meaning they can not branch off at any point along those lines)."}}
{"actor":{"display_login":"mpadge"}}