Closed boldtrn closed 7 years ago
When passing less than 3 points to the matrix api the results are just empty:
That would be a bug, do you have an example request?
That would be a bug, do you have an example request?
Sure, here is a sample request:
https://graphhopper.com/api/1/matrix?point=49.932707%2C11.588051&type=json&vehicle=car&debug=true&out_array=weights&out_array=times&out_array=distances&key=[KEY]
When you pass one point, I d expect an array of a single element that is 0 since the distance from point A to point A is always 0. This is exactly what you get:
"distances": [
[
0
]
]
When you pass two equal points, you ll get:
"distances": [
[
0,
0
],
[
0,
0
]
]
This makes sense. Doesnt it?
@oblonski thanks for clearing this up.
When you pass one point, I d expect an array of a single element that is 0 since the distance from point A to point A is always 0.
That makes sense, yes.
When you pass two equal points, you ll get ... - This makes sense. Doesnt it?
Yes, if they are equal, that makes sense. To be honest, I haven't thought about the meaning of the request. I think the reason why I expected an error is this statement in the docs:
Specify at least three points
Maybe we should change the docs in this case?
Yes, you are correct. We should change the docs. I suggest to change the exception when specifying zero points to "Specify at least a single point" or similar.
Will do!
This should be deployed now. Is this better?
Super. Thanks.
When passing less than 3 points to the matrix api the results are just empty:
I would have expected an exception?
When passing no points, I get an exception: