Significant discrepancies between the input coordinates and those used in the distance matrix

Hi,
I’m trying to calculate a distance matrix between 16 points. However, I’ve noticed that almost all the coordinates I input are not the same as the ones actually used to build the matrix. As a result, I end up with a matrix containing completely incorrect data.
Could it be because the 16 points are all located within a relatively small area of a city?
Is there any way to fix this?

Thanks a lot.

Hi, in order to better understand the issue and follow up on it, would you mind providing a sample matrix query and its result which you believe is “completely incorrect”? Cheers!

Thanks for the quick response. I attach two screenshots. The last one is the output .json.


Hey,

first, note that the openrouteservice uses [lon, lat] coordinate order.
Thus, points e.g. in northern Italy should be around [10, 45].

The points you input are all in Somaliland, near a mountain pass.
As none of them are on a road directly, they all get snapped to the road network - noted in your json response as snapped_distance.

Best regards

2 Likes

Thank you so much! What a silly mistake…
I just wanted to ask you one last question. Now I have a reasonable distance matrix. I noticed that some coordinates are still ‘approximate’, for the reason you mentioned earlier. I checked, though, that when I input the coordinates (whether original or approximate) directly into OpenStreetMap, the distances sometimes don’t match (with errors up to 400 meters). What is this ‘error’ due to? Is it not even fixable at the code level?

Thank you so much for your patience and support.

Hey,

from the top of my head, the most “surprising” thing that can happen is that you’d expect a coordinate to snap to a road that is visually nearby, but it doesn’t.

This is mostly because snapping is profile dependent. Any coordinate will only be snapped to the road network to that profile, and might not snap to small, semi-reachable sub-networks (i.e. road networks on islands).

As an example, imagine a valley with a river inside.
On one side of the river runs a street, on the other side a gravel road that a car could drive on. An input coordinate on the side of the gravel road might snap to the street on the other side for different reasons, including:

  • There is a barrier disallowing access to the gravel road. It is thus not reachable, and not snapped to.
  • Tagging on the gravel road may be off, or not allow car access
  • Tagging on the section of the gravel road that is closest has some issue, and the street is closer than the next section of gravel road that is suitable.

If you input coordinates into openstreetmap.org, only a subset of the actual information present can be visualized.

If the question persists, could you provide an example for this?
Ideally with the information which coordinate you input, which coordinate it snaps to and where you see the discrepancy to OpenStreetMap.

Best regards