Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix endpoint returning null for all locations when one route does not exist #1785

Open
1 task done
ddunlop opened this issue Apr 29, 2024 · 0 comments
Open
1 task done

Comments

@ddunlop
Copy link

ddunlop commented Apr 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Where did you encounter this issue?

live API, self-hosted instance

Request URL

https://api.openrouteservice.org/v2/matrix/driving-car

POST Request Body

{
  "locations": [
    [-157.8814736, 21.3280137],
    [-157.8667852, 21.3138143],
    [-158.0245043, 21.4545909],
    [-157.9076614, 21.6066256],
    [-157.9186302, 21.6240531],
    [-157.9813495, 21.6950804],
    [-156.2243193, 20.6204251]
  ],
  "destinations": [0],
  "metrics": ["distance", "duration"],
  "units": "mi"
}

Response

Response
{
    "durations": [
        [
            0.0
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ]
    ],
    "distances": [
        [
            0.0
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ],
        [
            null
        ]
    ],
    "destinations": [
        {
            "location": [
                -157.858147,
                21.309892
            ],
            "snapped_distance": 1.08
        }
    ],
    "sources": [
        {
            "location": [
                -157.858147,
                21.309892
            ],
            "snapped_distance": 1.08
        },
        {
            "location": [
                -157.850419,
                21.303858
            ],
            "snapped_distance": 12.08
        },
        {
            "location": [
                -157.83337,
                21.300157
            ],
            "snapped_distance": 39.68
        },
        {
            "location": [
                -157.833248,
                21.300057
            ],
            "snapped_distance": 35.92
        },
        {
            "location": [
                -156.464698,
                20.88822
            ],
            "snapped_distance": 20.03
        },
        {
            "location": [
                -159.319676,
                22.071742
            ],
            "snapped_distance": 16.72
        },
        {
            "location": [
                -155.6649,
                20.022491
            ],
            "snapped_distance": 13.04
        },
        {
            "location": [
                -155.097922,
                19.717017
            ],
            "snapped_distance": 8.69
        }
    ],
    "metadata": {
        "attribution": "openrouteservice.org | OpenStreetMap contributors",
        "service": "matrix",
        "timestamp": 1714395744688,
        "query": {
            "locations": [
                [
                    -157.8581401,
                    21.3098845
                ],
                [
                    -157.85031,
                    21.30382
                ],
                [
                    -157.833707,
                    21.299987
                ],
                [
                    -157.83342,
                    21.299776
                ],
                [
                    -156.46452,
                    20.88829
                ],
                [
                    -159.31975372883534,
                    22.071610308056204
                ],
                [
                    -155.66481,
                    20.02241
                ],
                [
                    -155.09788,
                    19.71695
                ]
            ],
            "profile": "driving-car",
            "responseType": "json",
            "destinations": [
                "0"
            ],
            "metrics": [
                "distance",
                "duration"
            ],
            "units": "mi"
        },
        "engine": {
            "version": "8.0.0",
            "build_date": "2024-03-21T13:55:54Z",
            "graph_date": "2024-04-28T13:28:40Z"
        }
    }
}

Current behavior

The last location is causing all of the distance & duration results to become null. If you remove the last location from the request then the distance & duration arrays start to return numerical values.

Expected behavior

All of the locations except for the last one should return numbers. The distance & duration for the last one should be null.

Openrouteservice Version

8.0.0

Build date

2024-03-21T13:55:54Z

Graph date

2024-04-28T13:28:40Z

Forum Topic Link

https://ask.openrouteservice.org/t/matrix-endpoint-returning-null-for-all-locations-when-some-routes-exist/6046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
ors general
  
To do
Development

No branches or pull requests

2 participants