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 traffic join to avoid 'traffic evaporating' #555

Closed
Robinlovelace opened this issue Nov 28, 2024 · 17 comments
Closed

Update traffic join to avoid 'traffic evaporating' #555

Robinlovelace opened this issue Nov 28, 2024 · 17 comments

Comments

@Robinlovelace
Copy link
Contributor

Robinlovelace commented Nov 28, 2024

There are small anomalies popping up e.g.:

image

https://osm.org/go/evfLeWTk?m=

It appears if the traffic is evaporating between these two high-flow section. There were a couple of other examples of this that occur if you need me to send them across too.

@Robinlovelace
Copy link
Contributor Author

It's there in the traffic data:

image

@Robinlovelace
Copy link
Contributor Author

Source: output of this:

> newhaven = zonebuilder::zb_zone("newhaven edinburgh")
> traffic_newhaven = traffic_volumes_scotland[newhaven, ]
nrow(traffic_> nrow(traffic_newhaven)
[1] 22672
> newhaven = zonebuilder::zb_zone("newhaven edinburgh", n_circles = 1)
Please set segment_center = TRUE to divide the centre into multiple segments
> traffic_newhaven = traffic_volumes_scotland[newhaven, ]
> mapview::mapview(traffic_newhaven, zcol = "pred_flows")
Browsing http://127.0.0.1:7996

@Robinlovelace
Copy link
Contributor Author

But the segment is totally missing from the CBD layer:

image

Source: https://nptscot.github.io/#/clos/#14.21/55.97816/-3.2004

@wangzhao0217
Copy link
Collaborator

error stem from this line:

osm_district = osm_national |>
        filter(osm_id %in% district_centroids$osm_id)

image

@wangzhao0217
Copy link
Collaborator

Can be fix by using:

      osm_district = osm_national[sf::st_union(district_geom), , op = sf::st_intersects]

but it is slow

image

@Robinlovelace
Copy link
Contributor Author

Great diagnosis of the issue, thanks Zhao!

@Robinlovelace
Copy link
Contributor Author

I think a better solution would be to update the LAD boundaries file. We could add a simple buffer but that would cause duplicates. I have an idea...

@Robinlovelace
Copy link
Contributor Author

Can be fix by using:

      osm_district = osm_national[sf::st_union(district_geom), , op = sf::st_intersects]

Another issue with that solution: it will lead to duplicate IDs. A reason for using centroids is you only get 1 per region.

@Robinlovelace
Copy link
Contributor Author

I'm on the case: I think I can come up with a quick fix to the LADs.

@Robinlovelace
Copy link
Contributor Author

Fix in progress:

image

@Robinlovelace
Copy link
Contributor Author

That section is mostly fixed:

image

@Robinlovelace
Copy link
Contributor Author

@Robinlovelace
Copy link
Contributor Author

Still a tiny bit missing:

image

@Robinlovelace
Copy link
Contributor Author

@Robinlovelace
Copy link
Contributor Author

It is covered by the new region boundary introduced in #557:

image

Source:

inputdata git:(main) ✗ qgis boundaries/la_regions_scotland_bfe_simplified_2023.geojson

@Robinlovelace
Copy link
Contributor Author

Should be fixed upstream in nptscot/osmactive#66

@Robinlovelace
Copy link
Contributor Author

Fixed in #550

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

No branches or pull requests

2 participants