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

TypeError in graph_from_file #51

Open
sstroemer opened this issue Oct 14, 2021 · 5 comments
Open

TypeError in graph_from_file #51

sstroemer opened this issue Oct 14, 2021 · 5 comments

Comments

@sstroemer
Copy link

I've downloaded a graph close to Vienna (AT) using:

LightOSM.download_osm_network(:bbox; network_type=:drive, save_to_file_location="./graph_drive", download_format=:osm, minlat=48.15, maxlat=48.40, minlon=16.20, maxlon=16.58)

Loading this graph using

LightOSM.graph_from_file("graph_drive.osm"; graph_type=:simple_weighted, precompute_dijkstra_states=false)

takes a really long time (just compared to previous tries in osmnx and igraph), and finally fails with

ERROR: TypeError: in typeassert, expected Int8, got a value of type Int64

Stacktrace:
[1] _roundedmean at C:\Users\USER\.julia\packages\LightOSM\Da141\src\graph.jl:218 [inlined]
[2] add_node_tags!(::LightOSM.OSMGraph{Int32,Int64,Float64}) at C:\Users\USER\.julia\packages\LightOSM\Da141\src\graph.jl:230
[3] graph_from_object(::LightXML.XMLDocument; network_type::Symbol, weight_type::Symbol, graph_type::Symbol, precompute_dijkstra_states::Bool, largest_connected_component::Bool) at C:\Users\USER\.julia\packages\LightOSM\Da141\src\graph.jl:36
[4] graph_from_file(::String; network_type::Symbol, weight_type::Symbol, graph_type::Symbol, precompute_dijkstra_states::Bool, largest_connected_component::Bool) at C:\Users\USER\.julia\packages\LightOSM\Da141\src\graph.jl:84
[5] top-level scope at REPL[2]:1

Unfortunately I could not trace that any further. Any ideas?
Using: LightOSM v0.1.18, Julia Version 1.5.2

@mmiller-max
Copy link
Contributor

mmiller-max commented Oct 20, 2021

@sstroemer thanks for reporting this.

The issue is with one way which has the ID 200655871. It is actually a tram way and therefore shouldn't be downloaded at all. The neighbouring tram ways (e.g. this) are not downloaded, so not sure what is different with this one. @captchanjack any ideas?

The actual error message occurs because with roads we check the lane values and ensure they are all Int8s, but not for railway and this one way is erroneously getting added to the graph.

A smaller graph that shows the same issue:

LightOSM.download_osm_network(:bbox; network_type=:drive, save_to_file_location="./graph_drive", download_format=:osm, minlat=48.18245539198438, maxlat=48.190409540565334, minlon=16.368255615234375, maxlon=16.38713836669922)

@mmiller-max
Copy link
Contributor

Concerning speed, downloading as a json is much quicker at the moment, and we are trying to improve the speed and release some benchmarks with respect to OSMX

@hs-ye
Copy link
Contributor

hs-ye commented Dec 12, 2021

@mmiller-max had a quick look at this, I suspect it's to do with this relation (a turn restriction) https://www.openstreetmap.org/relation/4498380 that is for both a way and the railway/tramway in question. The railroad is being downloaded due to it being part of the relation.

This is defintely an edge case, not sure how to even interpret the restriction data, I guess it's for Trams that can be on both normal roads and their dedicated track?? If the data is out of date we can just delete it from the OSM data, as an immediate fix.

@mmiller-max
Copy link
Contributor

@spcogg nice find! Perhaps then there are two fixes we should make:

  1. Double check that we've only downloaded ways of the type that we have requested, which would remove the tram way (and other situations where this happens)
  2. Remove the relation. It looks pretty weird. On street view there is no turning possible on the trams, but there is a sign saying "don't go down here" (I'm guessing) just to stop cars driving down it by mistake. So in real life there is that restriction, but technically it doesn't exist in the road network or the tram network as neither of those networks have both ways. That's my thoughts anyway!

@legoya
Copy link

legoya commented Feb 16, 2022

@mmiller-max @spcogg adding to this as I am trying to work with a rail data set and getting the same issue. To your point 1 @mmiller-max, are there assumptions when reading the map that drive paths are included somehow?

download_osm_network(
:polygon,
polygon=[
[153.029,-27.45], [153.039,-27.446], [153.04,-27.444], [153.04,-27.44], [153.041,-27.435], [153.04,-27.43],
[153.043,-27.428], [153.04,-27.426], [153.037,-27.4315], [153.036,-27.433], [153.032,-27.433], [153.027,-27.433],
[153.03,-27.436], [153.032,-27.435], [153.035,-27.437], [153.034,-27.439], [153.031,-27.442], [153.033,-27.445]
],
network_type=:rail,
download_format=:osm,
save_to_file_location="./map.osm"
);

Will be investigating on my side and update

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

4 participants