Repository navigation
feat: elevation_tool for ground elevation and climb along a route - #293
Open
mattpodwysocki wants to merge 9 commits into
Open
mattpodwysocki wants to merge 9 commits into
mattpodwysocki wants to merge 9 commits into
Conversation
Reads Mapbox Terrain-DEM v1 raster tiles and decodes heights on the server (a small PNG decoder on node:zlib, no new dependency). Takes up to 25 points, a path, or a directions_tool ref, and returns elevations or climb, descent, high and low points and a profile, plus a map ref. Long paths drop to a coarser zoom so a call needs at most 48 tiles. Part of #289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
directions_ref becomes route_ref, which also takes a map_matching_tool ref, so "how much did I climb on this run?" works from a GPS trace as well as a planned route. Matched pieces of a trace with gaps are joined in order. mapMatchingRequestFromRef is exported next to directionsRequestFromRef, and only accepts map_matching_tool's own profiles since the profile goes into the URL path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… at the point (#324) * feat(ground_location_tool): land use, water and elevation at the point ground_location_tool now says what the ground is at the coordinate: land use from Mapbox Streets v8 (park, cemetery, school...), a protected area it's in (with the name, e.g. a national park), a building it's inside, whether it's on water and how far the nearest water is, plus elevation from Terrain-DEM via elevation_tool's tile reader. Two Tilequery requests and one DEM tile, in parallel with the existing calls; a failure leaves those fields out. Adds tool-selection eval cases for land use and elevation questions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: CHANGELOG entry for #324 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(ground_location_tool): include picks land, water, elevation or traffic The spot facets are now chosen with include, so a call only pays for what the question needs (default: land, one Tilequery request), and a new layer is a new include value rather than a new tool. Adds traffic: live congestion per road class within 100 m from Mapbox Traffic v1. Water moves out of land into its own facet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ground_location_tool): address review feedback - A facet request that throws or returns bad JSON is left out instead of failing the whole call. - Wetlands from landuse_overlay are land use; only national parks are protected areas. - include defaults to none, so existing calls make no extra request. - Traffic distance_m points at the worst segment for each road class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
# Conflicts: # src/tools/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 4 of #289. The server had no elevation at all, so "how hilly is this bike route?" or "how high is this town?" had no answer from Mapbox data.
What it does
elevation_tooltakes one of:points: up to 25 places, returns each one's ground elevationpath: a line of up to 1,000 coordinatesdirections_ref: themapboxRender.reffrom adirections_toolresult, which the tool turns back into the full route withdirectionsRequestFromRef(feat(utils): export directionsRequestFromRef for routes by reference #276), so the model never copies route geometryFor a line it returns distance, climb, descent, start, end, highest and lowest points, and a profile of up to 50 points (12 in the text). It also returns a map ref with the line and ▲/▼ markers at the high and low points.
Why DEM tiles and not Tilequery
Tilequery can't read
mapbox.mapbox-terrain-dem-v1(422), and Terrain v2 contours come in 10 m steps or coarser:So the server fetches the DEM's
.pngrawtiles (terrain-RGB) and decodes heights, with bilinear interpolation between pixels. The PNG decoder is ~100 lines on Node'szlib(8-bit RGB/RGBA, not interlaced), so no new dependency.Cost
zoomandresolution_mso the model can say how rough it is.Live:
Open on #289
Whether
describe_tileset_toolandtilequery_toolcome next, and whether they're on by default, is waiting on the team (comment on #289). This tool is narrow, so it's on by default.Testing
-0 mnever prints.npm test: 1102 pass. Not yet tried in Claude Desktop or ChatGPT.🤖 Generated with Claude Code