pszufe / OpenStreetMapX.jl

OpenStreetMap (*.osm) support for Julia 1.0 and up
MIT License
118 stars 24 forks source link

Different edge counts in graph and edges field due to zero-distance nodes #32

Closed kramsretlow closed 3 years ago

kramsretlow commented 3 years ago

Hi and thanks for your work on this package. I've been getting acquainted with it the last 2 days.

Let's say my MapData is stored in an object named md . For my data set (map of Shanghai, over 170k edges), I found that length(md.e) - ne(md.g) equals 6 (rather than the zero that I expected).

After looking at the offending edges I found that each edge consists of a pair of nodes with distance(node1, node2) == 0. I see that in parseMap.jl the graph is created via g = LightGraphs.DiGraph(w), where w contains weights obtained by a call to distance( ). So the edges don't get created by LightGraphs.

At least this is my understanding of what's happening. It seems like a rare thing to have zero-distance edges in the OSM data, so I thought I would bring this to your attention. I don't know if it is design intent to maintain a 1:1 correspondence between edges(md.g) and md.e, but this occurrence breaks the correspondence.

Thanks!

pszufe commented 3 years ago

Done at v0.2.0 This release should make to the public Julia repo within in an hour. @kramsretlow please let me know if it works for you.

Thank you for the detailed descrption of the problem - this really helped to quickly address the issue!

pszufe commented 3 years ago

@kramsretlow is all OK now? May I close the issue?

kramsretlow commented 3 years ago

Sorry, I was away from this for a long weekend.

It works now, thank you. The two ways of getting the edges correspond for my data set.

I had a little trouble getting updated to the new version--I guess some compatibility/dependencies need to be updated?

I still have a question about the weights but maybe that's a different issue 😄

pszufe commented 3 years ago

Thanks for checking, I bumped the version to v0.2.1 - should now be OK :-)

kramsretlow commented 3 years ago

JSON compatibility seems fine, but still having a hard time getting OpenStreetMapX and OpenStreetMapXPlot to coexist. I just created a tiny pull request in OpenStreetMapXPlot.jl to bump OpenStreetMapX's version in [compat].

Cheers 🍺

pszufe commented 3 years ago

Hi, does it work for you now with the new versions released week ago? Can I close the issue?

kramsretlow commented 3 years ago

Yes it works 🍺