Skip to content

introduce POST /navigate that accepts GraphHopper request - #3136

Merged
karussell merged 6 commits into
masterfrom
post_navigate
Apr 1, 2025
Merged

karussell merged 6 commits into
masterfrom
post_navigate

Conversation

@karussell

Copy link
Copy Markdown
Member

This PR makes it possible to request a mapbox/osrm compatible response format using a graphhopper request.

/cc @boldtrn @OlafFlebbeBosch

}
}

// "speed":[24.7, 24.7, 24.7, 24.7, 24.7, 24.7, 24.7, 24.7, 24.7],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have issues testing this. Using config-example.yml and adding max_speed to graph.encoded_values I don't get annotations on links where OSM does have a max_speed set . (Using the GET variant of the request

curl -XGET 'http://localhost:8989/navigate/directions/v5/gh/car/9.010086,48.539837;9.019499,48.535342?alternatives=true&annotations=closure%2Cmaxspeed&geometries=polyline6&language=en&overview=full&roundabout_exits=true&steps=true&voice_instructions=true&voice_units=imperial&banner_instructions=true&details=max_speed'

And OSM import crashes if I set max_speed_calculator.enabled: true. Seems like it needs some encoded values ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't had time to actually test the PR, but you would need to use POST requests to request details from GraphHopper as far as I understand it?

That said, now that we have the annotations in the MapboxResponse, we could add the paramter for these in the GET request as well, that should allow to use the get request you show above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, currently I set the max_speed path detail only for the POST endpoint:

request.setPathDetails(List.of(INTERSECTION, MaxSpeed.KEY, DISTANCE, TIME, AVERAGE_SPEED));

but it is a good idea to consider the annotations parameter of the GET endpoint too.

And OSM import crashes if I set max_speed_calculator.enabled: true.

Will check this later.

@karussell karussell Mar 27, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And OSM import crashes if I set max_speed_calculator.enabled: true

You do not need to enable this. You just need to add max_speed to the encoded value. And yes, if you enable this you got a strange error message but I fixed this 2ba136e. I.e. you needed to additionally enable urban density calculation via e.g. graph.urban_density.threads: 1.

I have issues testing this

I'll try to to test this with the Maplibre SDK.

Do you know if the Maplibre SDK example app will show the maxspeed automatically if we return this info?

@karussell karussell Mar 28, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to to test this with the Maplibre SDK and e.g. enable this for the GET request too.

I just tried it and it seems that the maplibre demo app does no longer require the GET request and this POST request works already, but the maxspeed is not shown in the UI. But this is probably just a limitation of the demo app as in ferrostar this works also in the demo app.

I also found a bug - at least in the demo app: maplibre/maplibre-navigation-android#151

@karussell karussell added this to the 11.0 milestone Apr 1, 2025
@karussell
karussell merged commit a7ab841 into master Apr 1, 2025
@karussell
karussell deleted the post_navigate branch April 1, 2025 06:32

This branch was previously deployed

1 inactive deployment
benchmarks — 07a78658 Deployed Mar 27, 2025 by karussell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants