Vacuum-Tube / OSM-TPF2-Importer

This is a tool for the simulation game Transport Fever 2 for the automated reconstruction of real world places using OpenStreetMap data.
GNU General Public License v3.0
22 stars 0 forks source link

Bug: General instability, missing keys for "city_block" among others #1

Closed Luz5020 closed 4 months ago

Luz5020 commented 4 months ago

Description:

After getting the osm data from https://heightmap.skydark.pl/ with the coordinates 10.89326 long and 48.37110 lat with a size of 16.384 the converter keeps crashing because there seems to be an "isolated_dwelling" with no name. I have tried fixing it by removing the dwelling from the osm file by using JOSM but the issue persists, I'm guessing JOSM doesn't cleanly remove the data that is causing the issue.

Replicate:

  1. Download the map.osm from the link above with the given coordinates and size setting (if needed I can also provide the OSM data)
  2. Use the Python Tool
  3. The following error will be thrown: isolated_dwelling 1350112082 no name!

Possible Solutions:

Is there any way to properly handle this? I'm guessing with the large OSM Data that such small issues will happen to many users.

Luz5020 commented 4 months ago

Naming the dwelling using JOSM does fix the "no name!" issue but still causes a crash `Traceback (most recent call last):

File "C:\Users\username\Downloads\OSM-TPF2-Importer-main\python\main.py", line 34, in data = convert_data.convert(nodes, ways, relations, bounds, bounds_length)

File "C:\Users\username\Downloads\OSM-TPF2-Importer-main\python\convert_data.py", line 131, in convert places[tags["place"]].append({ KeyError: 'city_block'`

Luz5020 commented 4 months ago

Actually I'm encountering the "city_block" error on every .osm file. Might be an issue on my end but I haven't figured it out yet. There should be no need to crop because the osm and heightmap are made from identical areas. Could also be an issue that the converter can't handle things tagged "city_block"

Luz5020 commented 4 months ago

Appending "city_block" to the places list (line 37 in convert_data.py) seems to work, now the missing key is "islet". I'm guessing the tool was built with a set of keys and some places on osm have keys not present in the tool.

Luz5020 commented 4 months ago

After adding "islet" and "proposed" the tool seems to be running for a bit but finally crashes when using optimize_edges, the error thrown is: Cannot remove

Edge(10005273149,1468335003) is short (7.266), remove it

Traceback (most recent call last):

File "\python\main.py", line 37, in optimize_edges.optimize(data)

File "\python\optimize_edges.py", line 30, in optimize add_curve_tangents(paths_street, g)

File "\python\optimize_edges.py", line 172, in add_curve_tangents e12 = g.edges[n1, n2]["data"]

File "\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\networkx\classes\reportviews.py", line 1085, in getitem return self._adjdict[u][v]

KeyError: 2667036457

No idea if this is an issue on the osm data or the tool, I'd appreciate any help with this ^^.

Luz5020 commented 4 months ago

Going back to the original osm file I had used in the very first attempt, now the isolated dwelling doesn't cause a crash anymore. However the optimize edges still fails

Vacuum-Tube commented 4 months ago

Thanks, can confirm. For Frankfurt I didn't encounter any city_block or islet (nodes). Therefore, I did not consider it. This will probably be a general issue of this tool - some OSM data can always be unexpected and I cannot test the whole world.

Nevertheless, the error is easy to fix. The code should be more robost at this point, of course. I will take care of it.

Vacuum-Tube commented 4 months ago

The other error was a bit harder to find and solve. The cause are tracks on streets. They use sometimes the same nodes, which leads to troubles with the graph.

Please try again with the newest version, it should work now.

Luz5020 commented 4 months ago

Tried it with both osm files now, works. tysm