Route elevation profile (climb, descent, max grade) from the terrain tiles, and reach (isochrones) in the route panel

This commit is contained in:
randy committed 2026-11-13 22:55:55 +01:00
1 parent b80575828a
commit cca985d2b9
10 files changed
+274 -26

No files matched your search

+13
View File
@@ -463,6 +463,19 @@ module Maptool
halt 503, json(error: e.message)
end
# Where the stored vehicle gets in each of `minutes` from `center`
# ({"center": [lon, lat], "minutes": [30, 60]}). Open like /api/route.
post "/api/isochrone" do
body = JSON.parse(request.body.read)
json Routing.isochrone(VALHALLA_URL, body["center"], body["minutes"], Routing.vehicle(DATA_DIR))
rescue JSON::ParserError
halt 400, json(error: "invalid JSON")
rescue Routing::RouteError => e
halt 422, json(error: e.message)
rescue Routing::Unavailable => e
halt 503, json(error: e.message)
end
get "/api/vehicle" do
json Routing.vehicle(DATA_DIR)
end