bmwcarit / barefoot

Java map matching library for integrating the map into software and services with state-of-the-art online and offline map matching that can be used stand-alone and in the cloud.
Apache License 2.0
665 stars 186 forks source link

Maxspeed is 0 #68

Closed dvent7 closed 6 years ago

dvent7 commented 6 years ago

I got a NaN exception in filtprob when the maxspeed of a road is 0. Due to not setting the maxspeed of a road the line: the road.maxspeed() becomes 0 and the return value NaN

https://github.com/bmwcarit/barefoot/blob/c7b55daab5fe14c3e0b02f9e76e22ca509633ac4/src/main/java/com/bmwcarit/barefoot/roadmap/Time.java#L32

In my opinion here should a default value be applied when maxspeed is not set.

For example 80km/h.

https://github.com/bmwcarit/barefoot/blob/c7b55daab5fe14c3e0b02f9e76e22ca509633ac4/src/main/java/com/bmwcarit/barefoot/roadmap/Road.java#L95-L101

smattheis commented 6 years ago

There is a default value for maximum speed of a road. The question is: Why and where is your road's maximum speed is set to '0'?

dvent7 commented 6 years ago

Where can in find the default value of maxspeed in the BFMapWriter? I made a mistake and did not put a new element in the barefoot/map/tools/road-types.json

https://github.com/bmwcarit/barefoot/blob/master/map/tools/road-types.json#L1-L106

smattheis commented 6 years ago

Unfortunately, that's not a supported feature right now. The default value is used when road data is read initially from the database if a road's maximum speed is set to NULL. After that, road's have a fix assignment of maximum speed such that it's not a supported feature to rewrite the value. Therefore, best way is to delete bfmap file and reread the data from the database (barefoot map server) with the correct road-types.json defined.

dvent7 commented 6 years ago

OK thank you, iam wondering what is your default value when priority and maximum speed is set to NULL? I could not find part in the code.

smattheis commented 6 years ago

Sorry, forgot to mention that. That's not in the code, it's part of road-types.json file. This file is used at two separate points in the Barefoot tool chain. First, to filter road types when parsing OSM data. Second, to use default values when Barefoot reads data from the database.

dvent7 commented 6 years ago

Oh ok, so unclassified is the default value. Thank you