Closed gisxperts closed 9 years ago
Hi @gisxperts, you could add a little bit of code showing what you tried to do, so I can try to reproduce it?
list_coord = [[21.0566163803209, 42.004088575972],[21.3856064050746, 42.0094518118189],[20.9574645547597, 41.5286973392856],[21.1477394809847, 41.0691482795275],[21.5506463080973, 41.3532256406286]] list_id = ['name1', 'name2', 'name3', 'name4', 'name5'] time_matrix = osrm.table(list_coord, list_id, output='dataframe', host='http://localhost:5000')
@mthh could you maybe have a look at this?
@gisxperts @ustroetz my bad, it was only tested on python 3.4. As you suggested @gisxperts, fixing the type of the array at its creation do the job :
>>> platform.python_version()
'2.7.9'
>>> list_coord = [[40, -40],[21.3856064050746, 42.0094518118189],[20.9574645547597, 41.5286973392856],[21.1477394809847, 41.0691482795275],[21.5506463080973, 41.3532256406286]]
>>> list_id = ['name1', 'name2', 'name3', 'name4', 'name5']>>> time_matrix = osrm.table(list_coord, list_id, output='dataframe', host='http://localhost:5000')
>>> time_matrix
name1 name2 name3 name4 name5
name1 NaN NaN NaN NaN NaN
name2 NaN 0.0 88.1 149.4 106.3
name3 NaN 88.6 0.0 100.0 65.6
name4 NaN 137.6 99.8 0.0 49.4
name5 NaN 94.6 65.6 48.8 0.0
osrm responds with integer values in table, leads on windows (python 2.7.10, numpy 1.9.2, download python_osrm last night) to the error message 'ValueError: cannot convert float to NaN to integer ' for line 201.
my quick and dirty workaround was mat[mat == 3579139.4] = -9999, but better would be to have the array always created as float, or check what type of array is created and depending on the outcome assign proper NaN.