openrouteservice icon indicating copy to clipboard operation
openrouteservice copied to clipboard

Foot-walking profile (preference shortest) does not correctly avoid ways tagged with highway trunk

Open Taar opened this issue 2 years ago • 0 comments

Related forum post


Here's what I did

Using the API playground:

POST: https://api.openrouteservice.org/v2/directions/foot-walking/geojson

With the following json payload:

{"coordinates":[[-83.033492,42.312440],[-83.039040,42.317549]],"preference":"shortest"}

Here's what I got

ors-trunk-2022-09-06_14-55

Json payload
{
    "type": "FeatureCollection",
    "features": [
        {
            "bbox": [
                -83.039061,
                42.312439,
                -83.033485,
                42.317541
            ],
            "type": "Feature",
            "properties": {
                "segments": [
                    {
                        "distance": 838.8,
                        "duration": 603.9,
                        "steps": [
                            {
                                "distance": 1.6,
                                "duration": 1.2,
                                "type": 11,
                                "instruction": "Head northeast on Elliott Street East",
                                "name": "Elliott Street East",
                                "way_points": [
                                    0,
                                    1
                                ]
                            },
                            {
                                "distance": 285.7,
                                "duration": 205.7,
                                "type": 0,
                                "instruction": "Turn left onto Goyeau Street",
                                "name": "Goyeau Street",
                                "way_points": [
                                    1,
                                    7
                                ]
                            },
                            {
                                "distance": 142,
                                "duration": 102.2,
                                "type": 12,
                                "instruction": "Keep left",
                                "name": "-",
                                "way_points": [
                                    7,
                                    17
                                ]
                            },
                            {
                                "distance": 46.5,
                                "duration": 33.5,
                                "type": 13,
                                "instruction": "Keep right",
                                "name": "-",
                                "way_points": [
                                    17,
                                    19
                                ]
                            },
                            {
                                "distance": 160.2,
                                "duration": 115.4,
                                "type": 2,
                                "instruction": "Turn sharp left onto Detroit-Windsor Tunnel",
                                "name": "Detroit-Windsor Tunnel",
                                "way_points": [
                                    19,
                                    33
                                ]
                            },
                            {
                                "distance": 64,
                                "duration": 46.1,
                                "type": 0,
                                "instruction": "Turn left onto Park Street East",
                                "name": "Park Street East",
                                "way_points": [
                                    33,
                                    35
                                ]
                            },
                            {
                                "distance": 138.9,
                                "duration": 100,
                                "type": 1,
                                "instruction": "Turn right onto Ouellette Avenue",
                                "name": "Ouellette Avenue",
                                "way_points": [
                                    35,
                                    36
                                ]
                            },
                            {
                                "distance": 0,
                                "duration": 0,
                                "type": 10,
                                "instruction": "Arrive at Ouellette Avenue, on the right",
                                "name": "-",
                                "way_points": [
                                    36,
                                    36
                                ]
                            }
                        ]
                    }
                ],
                "summary": {
                    "distance": 838.8,
                    "duration": 603.9
                },
                "way_points": [
                    0,
                    36
                ]
            },
            "geometry": {
                "coordinates": [
                    [
                        -83.033491,
                        42.312439
                    ],
                    [
                        -83.033485,
                        42.312441
                    ],
                    [
                        -83.033747,
                        42.312849
                    ],
                    [
                        -83.034205,
                        42.313561
                    ],
                    [
                        -83.034446,
                        42.313946
                    ],
                    [
                        -83.034481,
                        42.314002
                    ],
                    [
                        -83.034713,
                        42.314374
                    ],
                    [
                        -83.034962,
                        42.314766
                    ],
                    [
                        -83.035184,
                        42.314873
                    ],
                    [
                        -83.035266,
                        42.315019
                    ],
                    [
                        -83.035378,
                        42.315084
                    ],
                    [
                        -83.035617,
                        42.315109
                    ],
                    [
                        -83.035683,
                        42.315113
                    ],
                    [
                        -83.035749,
                        42.315117
                    ],
                    [
                        -83.035922,
                        42.315129
                    ],
                    [
                        -83.03617,
                        42.315168
                    ],
                    [
                        -83.036294,
                        42.315222
                    ],
                    [
                        -83.03642,
                        42.315296
                    ],
                    [
                        -83.036588,
                        42.315494
                    ],
                    [
                        -83.036696,
                        42.31566
                    ],
                    [
                        -83.036695,
                        42.315645
                    ],
                    [
                        -83.036726,
                        42.315575
                    ],
                    [
                        -83.036823,
                        42.315524
                    ],
                    [
                        -83.036923,
                        42.315527
                    ],
                    [
                        -83.037015,
                        42.315583
                    ],
                    [
                        -83.037153,
                        42.315795
                    ],
                    [
                        -83.037178,
                        42.315834
                    ],
                    [
                        -83.037212,
                        42.315886
                    ],
                    [
                        -83.037232,
                        42.315918
                    ],
                    [
                        -83.037404,
                        42.31628
                    ],
                    [
                        -83.037429,
                        42.316326
                    ],
                    [
                        -83.037492,
                        42.316435
                    ],
                    [
                        -83.037521,
                        42.31648
                    ],
                    [
                        -83.037588,
                        42.316593
                    ],
                    [
                        -83.037784,
                        42.316546
                    ],
                    [
                        -83.038329,
                        42.316416
                    ],
                    [
                        -83.039061,
                        42.317541
                    ]
                ],
                "type": "LineString"
            }
        }
    ],
    "bbox": [
        -83.039061,
        42.312439,
        -83.033485,
        42.317541
    ],
    "metadata": {
        "attribution": "openrouteservice.org | OpenStreetMap contributors",
        "service": "routing",
        "timestamp": 1662564583676,
        "query": {
            "coordinates": [
                [
                    -83.033492,
                    42.31244
                ],
                [
                    -83.03904,
                    42.317549
                ]
            ],
            "profile": "foot-walking",
            "preference": "shortest",
            "format": "geojson"
        },
        "engine": {
            "version": "6.7.0",
            "build_date": "2022-02-18T19:37:41Z",
            "graph_date": "2022-08-30T10:07:49Z"
        }
    }
}

Here's what I was expecting

I was expecting the foot-walking profile while using the shortest preference to still avoid ways that aren't accessible to foot traffic. The issue with the directions returned is that those ways tagged with name=Detroit-Windsor Tunnel don't have sidewalks and therefore shouldn't be considered. Basically, I expected this line for the FootFlagEncoder object to always be enforced regardless of the preference used. As a side note, I understand that this is a bit of an edge case since this area is strictly off limits to foot traffic as it's a car traffic border crossing between Canada and the USA. Maybe the underlying OSM should contain additional tags noting that this area is off limits to food traffic.

However, I still would expect a way tagged with highway=trunk and that doesn't have a tag for sidewalks to be avoided.

Here's a screen shot of the tags for one of the ways used in the route. osm-tunnel-trunk-2022-09-06_14-56


Here's what I think could be improved

The foot-walking profile while using the preference shortest should always avoid ways with the highway tag values trunk, trunk_link, primary, primary_link unless they are also tagged with a sidewalk.

Taar avatar Sep 07 '22 16:09 Taar