aspectumapp / osm2geojson

Convert OSM and Overpass XML/JSON to GeoJSON
MIT License
97 stars 15 forks source link

Doesn't handle relation with <member role ='from' or 'to' or 'via'> #8

Closed bxlt closed 4 years ago

bxlt commented 4 years ago

After I down load a small piece of osm from my neighbourhood and try to parse it. Interpreter gives me the error below :

Ref for way not found in index {'ref': 61127295, 'role': 'from', 'type': 'way'}
Failed to make way in relation {'id': 3308856, 'timestamp': '2013-11-04T17:59:21......
Ref for way not found in index {'ref': 61127295, 'role': 'to', 'type': 'way'}
Failed to make way in relation {'id': 3308856, 'timestamp': '2013-11-04T17:59:21......
multiline member not handled {'role': 'via', 'ref': 254479716, 'type': 'node'}
Failed to make way in relation {'id': 3308856, 'timestamp': '2013-11-04T17:59:21......

I think the parser cannot handle this type of relation below. since no error was shown after remove this section. Thanks in advance!

<relation id="3821928" visible="true" version="1" changeset="22936846" timestamp="2014-06-15T02:28:52Z" user="andrewpmk" uid="1679">
  <member type="way" ref="31876040" role="from"/>
  <member type="way" ref="23498139" role="to"/>
  <member type="node" ref="254479868" role="via"/>
  <tag k="restriction" v="no_straight_on"/>
  <tag k="type" v="restriction"/>
 </relation>
rapkin commented 4 years ago

Can you provide your osm file? Will be great if you can give me small example of your osm file (so I can create test for this situation).

bxlt commented 4 years ago

Here it is

rapkin commented 4 years ago

No errors by your example. Just warnings (it's normal when you have partial OSM data). For example relation 3821928 have way with ref 31876040, but in file I can't find object with id 31876040 (I also checked on downloaded map from OSM).

If you expect other geometry in result - provide other example (also you can try this tool to test your examples https://tyrasd.github.io/osmtogeojson/)

bxlt commented 4 years ago

https://drive.google.com/file/d/1LovppGWATaAxZXtIXnsS_1oNomAOKhRK/view?usp=sharing

Sorry for replying late. Here is a sample file I used. Please try this one.

rapkin commented 4 years ago

I can't work with pdf, you can use .osm for OSM XML. Also i don't need all your example (just small part where you see problem).

BTW i changed logging strategy (in version 0.1.23 added parameter log_level). So now you will not see all warnings by default.