NREL / mappymatch

Pure-python package for map matching
http://mappymatch.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
58 stars 19 forks source link

Match expects the distance attribute to be a float #89

Closed sjirwin closed 2 years ago

sjirwin commented 2 years ago

Match() defines its distance attribute as float and code elsewhere assumes that it is a float. e.g., from compute_cutting_points()

if abs(m.distance - distance_epsilon) < cutting_thresh:
                        cutting_points.append(CuttingPoint(i))

however, in orsm'.py the function _parse_leg() (inner function of parse_osrm_json()) constructs Match objects with distance=None. this is both a mypy error and can cause an error in functions like compute_cutting_points()

discussed with @nreinicke and decided to change the None to float('infinity')

nreinicke commented 2 years ago

Included with #90