-
Notifications
You must be signed in to change notification settings - Fork 58
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
ENH: always store x, y as node attributes in gdf_to_nx, optionally cast node labels to integers #546
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #546 +/- ##
=====================================
Coverage 97.4% 97.4%
=====================================
Files 26 26
Lines 4317 4328 +11
=====================================
+ Hits 4203 4214 +11
Misses 114 114
|
We won't Lines 282 to 283 in 1224778
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Shall we get @anastassiavybornova's eyes on it?
Ideally |
hi! cool! let me have a closer look at this tomorrow - the way i saw it the main issue with the previous version of _generate_primal was how the key (as in u,v,key) attribute was generated. (which is relevant for e.g. the osmnx.simplification function to not just run, but to return properly simplified linestrings) |
could that be a bug more than anything else? |
Not strictly a bug but laziness. It seems that in the meantime, networkx learned to deal with it automatically, so I've removed any custom handling of keys. Now it should match 0...n behaviour you implemented in your PR. |
Since this is passing, do we think it a good idea to go ahead and merge? Then we can get @anastassiavybornova's retroactive review when she has time? |
Let's wait, there's no rush, is there? |
I suppose not. |
hi again! so here's my 2 cents:
|
That was always the assumption here. Or more specifically, this function does not care and ensures no change of information between the two representations of the same.
How come? 2-point linestring either means radical simplification of input geometries or their division to individual segments, causing a ton of degree-2 nodes. Let's pick it up tomorrow.
We do have some tooling, like removal of degree 2 nodes but I'd need to better understand the expected outcome. |
yes to the ton of degree 2 nodes --> that's what osmnx.simplification.simplify_graph expects as input. but yeah, let's discuss tomorrow! let's see if we deem it necessary to cater for this |
Okay. But that does not change the scope of |
This supersedes #545 (sorry @anastassiavybornova!). While getting into a review of #545, I wrote this to verify my hypothesis and given it is way simpler and way more generic, it is preferable solution.
We'll also need to adapt
nx_to_gdf
to support the option with integer labels but will do that as a follow-up.closes #545