Skip to content

add support for /expansion for routing #309

@nilsnolde

Description

@nilsnolde

Description

This is the last important debugging support I'd like to include at some point.

The /expansion endpoint visualizes the routing algorithm's expansion via a HUGE LineString geojson, where every feature is a single edge with various attributes. Even worse, most edges are geometrically duplicated, one for forward, one for reverse. That leads to response sizes of dozens of MB even for small-ish routes in dense networks.. However, it's invaluable to understand the behavior of the routing engine. Together with #307 & #308 we'd have a very very good toolkit on our hands to efficiently debug routing issues.

UI wise it'd be mostly important to style the layer according to edge_status (see docs) with different colors. On left click it should show a small attribute table for each feature.

The order of features in the /expansion response has an intrinsic meaning: the further along in the response, the further along in the expansion the feature/edge was added to the open set. That can be used to visualize expansion progress over time/iteration via a small slider which shows/hides the line features according to their index in the overall geojson.

A reference request is

curl --request POST \
  --url https://valhalla1.openstreetmap.de/expansion \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: insomnia/9.1.1' \
  --data '{
	"action": "route",
	"expansion_properties": [
		"cost",
		"duration",
		"distance",
		"edge_id",
		"pred_edge_id",
		"edge_status",
		"expansion_type"
	],
	"costing": "auto",
	"locations": [
		{
			"lon": 13.410081,
			"lat": 52.528796
		},
		{
			"lon": 13.398181,
			"lat": 52.506847
		}
	]
}' > expansion.geojson

Screenshots

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions