Hi, I am new to OSRM and have trying to implement a table service locally. I noticed however, that the final three examples given in the OSRM WIKI (under HTTP API section) do not seem to produce distance or duration tables.
Instead, I get the error message: "Coordinate is invalid: 13.428555,52.523219&annotations=distance,duration"
for all three of the wiki table service examples with the annotations parameter, namely:
http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219&annotations=distance
http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219&annotations=duration
http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219&annotations=distance,duration
I hope I've not lost the plot and am missing something obvious, I apologise in advance if that's the case.
Hi @pc0179 !
Thanks for you interest in the distance table.
There are two reasons, your request doesn't work:
OSRM table calls have the format table/v1/driving/<COORDINATES>?<OTHER-PARAMS>
so you would have to rename your requests to
http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=distancehttp://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=durationhttp://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=distance,durationThe second reason it does not work is that you're too cutting edge and even though the distance table work is merged to master is hasn't been officially released yet and the demo server only runs the latest release (which is 5.17 and it doesn't include distance tables yet)
If you run the server yourself locally, the requests should work.
I am going to close this issue but feel free to reopen if questions remain :)
OMG, I just noticed your examples were copied from our docs.
I will change asap. Thanks for flagging! 馃檲
Thanks for the speedy reply and doc changes!
Unfortunately I am still not able to get the table distance service to work locally.
I have installed the latest master version ("osrm-routed --version" returns: v5.18.0) and ran the following query:
http://localhost:5000/table/v1/driving/12.481725,41.897818;12.458922,41.906511;12.475515,41.897568;12.485879,41.871178?annotations=distance
which produces the error "InvalidQuery,
Oddly, the table service works when I omit the annotations parameter, am I on the wrong version?
Hmmm. @pc0179
1) can you send us the git sha you're on?
2) can you send us exactly how you preprocess data and call the osrm parts?
3) can you send us the exact request? I guess it is a curl?
4) are you using CH or MLD? currently, distances only works for CH, the PR for MLD is not ready yet (even though it is close)
5) can you send the whole response after InvalidQuery?
I just tried with
master 1a1293608d1e52d1aa8ec63dadb132ea5afd02bb build/osrm-extract data/melbourne.osm.pbf && build/osrm-contract data/melbourne.osrm && build/osrm-routed data/melbourne.osrm
curl http://localhost:5000/table/v1/driving/12.481725,41.897818\;12.458922,41.906511\;12.475515,41.897568\;12.485879,41.871178\?annotations\=distance
{"sources":[{"location":[144.942397,-37.789462],"hint":"qBQAgP___38AAAAANwAAAAAAAADyAQAAAAAAAMSYkkIAAAAA87MhRAAAAAA3AAAAAAAAAPIBAADDAACAPaWjCOpgv_29dL4AWk9_AgAAHwgSK38m","name":"Flemington Road"},{"location":[144.942397,-37.789462],"hint":"qBQAgP___38AAAAANwAAAAAAAADyAQAAAAAAAMSYkkIAAAAA87MhRAAAAAA3AAAAAAAAAPIBAADDAACAPaWjCOpgv_2qG74AT3F_AgAAHwgSK38m","name":"Flemington Road"},{"location":[144.942397,-37.789462],"hint":"qBQAgP___38AAAAANwAAAAAAAADyAQAAAAAAAMSYkkIAAAAA87MhRAAAAAA3AAAAAAAAAPIBAADDAACAPaWjCOpgv_17XL4AYE5_AgAAHwgSK38m","name":"Flemington Road"},{"location":[144.942397,-37.789462],"hint":"qBQAgP___38AAAAANwAAAAAAAADyAQAAAAAAAMSYkkIAAAAA87MhRAAAAAA3AAAAAAAAAPIBAADDAACAPaWjCOpgv_33hL4ASud-AgAAHwgSK38m","name":"Flemington Road"}],"destinations":[{"location":[144.942397,-37.789462],"hint":"qBQAgP___38AAAAANwAAAAAAAADyAQAAAAAAAMSYkkIAAAAA87MhRAAAAAA3AAAAAAAAAPIBAADDAACAPaWjCOpgv_29dL4AWk9_AgAAHwgSK38m","name":"Flemington Road"},{"location":[144.942397,-37.789462],"hint":"qBQAgP___38AAAAANwAAAAAAAADyAQAAAAAAAMSYkkIAAAAA87MhRAAAAAA3AAAAAAAAAPIBAADDAACAPaWjCOpgv_2qG74AT3F_AgAAHwgSK38m","name":"Flemington Road"},{"location":[144.942397,-37.789462],"hint":"qBQAgP___38AAAAANwAAAAAAAADyAQAAAAAAAMSYkkIAAAAA87MhRAAAAAA3AAAAAAAAAPIBAADDAACAPaWjCOpgv_17XL4AYE5_AgAAHwgSK38m","name":"Flemington Road"},{"location":[144.942397,-37.789462],"hint":"qBQAgP___38AAAAANwAAAAAAAADyAQAAAAAAAMSYkkIAAAAA87MhRAAAAAA3AAAAAAAAAPIBAADDAACAPaWjCOpgv_33hL4ASud-AgAAHwgSK38m","name":"Flemington Road"}],"code":"Ok","distances":[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]}%
it returns a zero-matrix because all coordinates are snapped to the same coordinate, because my data is melbourne and doesn't include the actual coords, but at least it is not an InvalidQuery, so it is hard for me to reproduce.
I really am grateful for your effort and patience,
In answer to your questions:
I was using SHA = c4eff6cd656b49e3cb5fc841e868031e12a97465 , however, I just now updated to 1a1293608d1e52d1aa8ec63dadb132ea5afd02bb (neither seem to work with my request)
for loading the data: osrm-extract ~/centro-latest.osm.pbf && osrm-contract ~/centro-latest.osrm && osrm-routed centro-latest.osrm -a CH
(link to my osm file: https://www.dropbox.com/s/tmwnt8iqafbx9gt/centro-latest.osm.pbf?dl=0 if it helps)
my full curl request:
curl http://localhost:5000/table/v1/driving/12.481725,41.897818;12.458922,41.906511;12.475515,41.897568;12.485879,41.871178\?annotations\=distance
I'm definitely using CH
full error message: {"message":"Query string malformed close to position 98","code":"InvalidQuery"} which I think position 98 is where the "?" is.
Many thanks,
Pietro
I am so sorry I cannot reproduce. 馃槥 It works on my machine. 馃 Can you try
curl "http://localhost:5000/table/v1/driving/12.481725,41.897818;12.458922,41.906511;12.475515,41.897568;12.485879,41.871178?annotations=distance"
just to make sure?
One thing to check - make sure you don't have an old osrm-routed process running somewhere.
osrm-routed uses the SO_REUSEPORT socket option, so starting a new osrm-routed process will not report Error: socket already in use.
It seems like maybe there's an older version of OSRM running on the same port perhaps? Maybe try starting the new one up on a different port (add -p 5001 to the osrm-routed command-line) and hit that with curl instead.
I don't know why but running 'git reset --hard' did not seem to update my osrm version from c4eff6c to 1a12936, it seemed stuck on the former version. I re-installed and built from source after which it finally allowed me to update to 1a12936 which now works beautifully. Many thanks for all your help!
HI @chaupow, @danpat, I changed osrm-backend so values of "weight" and "duration" won't be same anymore. Now I'm trying annotations=weight, but it's not working, any alternative way.
If there isn't any way, then which part of the code I need to change.
Most helpful comment
Hi @pc0179 !
Thanks for you interest in the distance table.
There are two reasons, your request doesn't work:
OSRM table calls have the format
table/v1/driving/<COORDINATES>?<OTHER-PARAMS>so you would have to rename your requests to
http://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=distancehttp://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=durationhttp://router.project-osrm.org/table/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?annotations=distance,durationThe second reason it does not work is that you're too cutting edge and even though the distance table work is merged to
masteris hasn't been officially released yet and the demo server only runs the latest release (which is5.17and it doesn't include distance tables yet)If you run the server yourself locally, the requests should work.
I am going to close this issue but feel free to reopen if questions remain :)