a-b-street / osm2lanes

A common library and set of test cases for transforming OSM tags to lane specifications
https://a-b-street.github.io/osm2lanes/
Apache License 2.0
34 stars 2 forks source link

unexpected speed 3025 mph #153

Closed dabreegster closed 2 years ago

dabreegster commented 2 years ago

This one's interesting, because someone has fixed the upstream data since then. It causes a panic now, so I'll definitely add a test case. https://www.openstreetmap.org/way/102917976 is now fixed, but in my old copy:

        <way id="102917976" version="15" timestamp="2021-07-08T22:56:38Z" changeset="0">
                <nd ref="1487927529"/>
                <nd ref="7085519171"/>
                <nd ref="8523528017"/>
                <nd ref="3629413438"/>
                <nd ref="4273741094"/>
                <tag k="bicycle" v="designated"/>
                <tag k="cycleway" v="lane"/>
                <tag k="highway" v="secondary"/>
                <tag k="lanes" v="5"/>
                <tag k="lanes:backward" v="1"/>
                <tag k="lanes:both_ways" v="1"/>
                <tag k="lanes:forward" v="3"/>
                <tag k="maxspeed" v="3025 mph"/>
                <tag k="name" v="South Royal Brougham Way"/>
                <tag k="name_1" v="State Route 519"/>
                <tag k="surface" v="asphalt"/>
                <tag k="tiger:cfcc" v="A31"/>
                <tag k="tiger:county" v="King, WA"/>
                <tag k="tiger:name_base" v="Royal Brougham"/>
                <tag k="tiger:name_base_1" v="State Route 519"/>
                <tag k="tiger:name_direction_prefix" v="S"/>
                <tag k="tiger:name_type" v="Way"/>
                <tag k="turn:lanes:backward" v="right"/>
                <tag k="turn:lanes:both_ways" v="left"/>
        </way>

/home/dabreegster/.cargo/git/checkouts/osm2lanes-0a9401f46878d04a/df0e7bb/osm2lanes/src/transform/tags_to_lanes/separator/semantic.rs:27:18

droogmic commented 2 years ago

I guess when a speed is ridiculous we just add an "unsupported", and pretend the tag wasn't there.

dabreegster commented 2 years ago

I can't even get the test to reproduce this crash: https://github.com/a-b-street/osm2lanes/commit/b5ed9394b73a054f98f2f29535dca34a866d3803 Currently tracing through to figure out exactly when SpeedClass::from is called and why it's not happening from the test, even though the tags match what I'm feeding in

dabreegster commented 2 years ago

Ahh, https://github.com/a-b-street/osm2lanes/blob/f651f6b295ff3de6097163f5d3879c33100bcd09/osm2lanes/src/test.rs#L417 was too much magic for me. Even with 'rust: separator: true', the expected output needs to have at least some separator to enable the option. I can repro the original bug now.