-
Notifications
You must be signed in to change notification settings - Fork 1
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
Road importance #3
Comments
These lines of code may help: https://github.com/cyipt/popupCycleways/blob/master/code/build.R#L129-L132 The |
I had an idea overnight so I've committed some extra code. routing from everywhere to everywhere is the same as edge betweenness centrality. And dodgr has a new function to do this directly. This removed all the faffing making the flow matrix. But for some reason the results are lost when converting back to sf object (see UrbanAnalyst/dodgr#138) to I've written a little function that uses |
@mem48 Also, I can't get past line 169 as I don't have the object "gsf".
I suppose it is created in the sfnetwork_test file but I get an error
Not sure about either why I am getting different results. I restarted R and have even updated to version 4. |
@unbrother sorry my mistake I forgot to commit my final changes, try now. I think you are getting the same result, but I adjusted the colour bands on the plot I posted. The code should be in the latest commit |
The sfnetwork package doesn't work with roundabouts. Which is what causes the error you got. I think that it might be a dead end until they fix this bug luukvdmeer/sfnetworks#59 |
Heads-up: that issue is fixed in the development version. See here: luukvdmeer/sfnetworks#59 (comment)
There are other issues you should consider when using that approach, as documented here: https://osf.io/wtqas/ |
@mem48
As we don't have that now, would an st_join work correctly? This is the "graphs" object: |
@unbrother I've cleaned and updated my code It should now run from end to end and make the following plots |
I get a model to predict traffic with an r squared of 0.35 so not great, but a start. Now the task is to work out how to improve those values. I'd definitely try to fix those two points with very high centrality but low traffic, I expect the weighting of the roads might be the problem. |
Intresting paper to look at https://www.sciencedirect.com/science/article/pii/S096669231930568X |
@mem48
Then I tried the poisson model which replicates the same family used in the paper and get similar results
I am not entirely sure if having more data would help the model, but if so, I believe having major roads in the set is important. But now I am a little confused on how to add both sets together, I am working in a file named major_centrality_test but still with limited results. Since the treatment for osm_minor and osm_major has been different, I am having trouble finding where some variables get added (or dropped). |
Ok I think you need to check the docs on joins, for example
doesn't need a
Is an attribute join and needs a |
for
You are joining the second argument onto the first argument so the geometry of the fist is kept. THis is why you get the tmap error. I've switched the order to make it work. I also had to add a
to get your code to work on my computer |
Be careful when joining for creating duuplicates. For example when you have two overlapping buffers and join, you might end up with a road being duplicated |
I also added
So you're clearly making progress |
If you think you need more data, you could try running the code on a larger area e.g Leeds. The Isle of Wight is good for testing as it is very small, but it not a typical place, and you now seem to have the basics working. I'd suggest reformatting the code a little so that you can run the timeconsuming bits once and then save the results. You will want to play around with different models and variables, and you don't have to recalculate centrality every time. |
The road importance part of the postGRE code first makes subdivisions enclosed by the major roads. I am not sure how to do this in R, I believe I would just need to draw a polygon between those lines but do not know how to make R select the enclosed areas.
After that they made something different for roads outside of these areas, which they name coastal roads. I have not checked this in full but I am sure it will be a challenge for me.
Until now, I used dodgr with weight_streetnet() to get some kind of relative weighting and I was considering that as the road importance. But this is not the process originally used.
@mem48 and @Robinlovelace, do you have any pointers or ideas on how to attack this part?
The text was updated successfully, but these errors were encountered: