matrix api request, null location

36 views
Skip to first unread message

Marcos J. Andreo

unread,
Jan 21, 2018, 1:33:12 PM1/21/18
to openrouteservice.org
I get 'null' in matrix response. The coordinates are from google geocoding api. 

post body: {"profile":"driving-hgv","locations":[[37.7719964,-1.5002649],[37.7599261,-1.5022095],[37.7638367,-1.5027903],[37.7771242,-1.4988164],[37.7652181,-1.5029653],[37.7746854,-1.4930215]],"sources":["0","1"],"destinations":"all","metrics":"distance","resolve_locations":"false","units":"km","optimized":"true"}

response: {"distances":[[0,1.28,1.09,null,0.65,null],[1.28,0,0.19,null,0.62,null]],"destinations":[{"location":[37.765222,-1.514169],"snapped_distance":1719.73},{"location":[37.756048,-1.507712],"snapped_distance":748.46},{"location":[37.757362,-1.508742],"snapped_distance":977.73},{"location":null},{"location":[37.7602,-1.511187],"snapped_distance":1070.88},{"location":null}],"sources":[{"location":[37.765222,-1.514169],"snapped_distance":1719.73},{"location":[37.756048,-1.507712],"snapped_distance":748.46}],"info":{"service":"matrix","engine":{"version":"4.4.0","build_date":"2018-01-19T16:53:44Z"},"attribution":"openrouteservice.org | OpenStreetMap contributors","timestamp":1516559493287,"osm_file_md5_hash":"21986ada393772cf5d8cd06264ea90b3","query":{"profile":"driving-hgv","units":"km"}}}

pretty matrix response: 
0.0 1.28 1.09 null 0.65 null 

1.28 0.0 0.19 null 0.62 null 


Thanks ;)

Nils Nolde

unread,
Jan 21, 2018, 6:03:42 PM1/21/18
to openrouteservice.org
Hi Marcos,

where are the coordinates supposed to be?

It looks very much like a typical Google error: as the only routing engine provider I know, they use lat/long as return values. While everyone else uses long/lat. Pretty sure the case with you too, unless you're -1.5° South of the equator;)

So, just switch the coordinates and you should be fine.

Cheers
Nils
Reply all
Reply to author
Forward
0 new messages