Files
editor/e2e
SHAIK KHADEER BASHA 07bc2bcc3b Add a line metrics checkbox to GeoJSON sources for line-gradient (#2403)
Fixes #292.

`line-gradient` only renders when the line's GeoJSON source has
`"lineMetrics": true`, and Maputnik had no way to set that. Nothing in
`src` set or showed `lineMetrics`, so a gradient could only be made to
work by editing the source in the code editor. GeoJSON sources (both the
URL and the inline JSON kind) now have a "Line metrics" checkbox in the
Data Sources modal.

The `line-gradient` property itself already works: it shows up under the
line layer's paint properties and is edited in the expression editor
with `["line-progress"]`. I checked that with a style using an
`interpolate` over `line-progress`. So the checkbox was the missing
piece.

**Before / after** (Data Sources → Add New Source → GeoJSON (URL)):

| Before | After |
|---|---|
| <img
src="https://raw.githubusercontent.com/KhadeerBasha1232/maputnik/pr-assets/pr-292/before-geojson-source.png"
width="400"> | <img
src="https://raw.githubusercontent.com/KhadeerBasha1232/maputnik/pr-assets/pr-292/after-geojson-source.png"
width="400"> |

**Performance:** no impact on Maputnik itself. `lineMetrics` only
changes how MapLibre tiles that GeoJSON source when someone turns it on,
and that cost is the reason it's off by default in the spec.

## Launch Checklist

 - [x] Briefly describe the changes in this PR.
 - [x] Link to related issues: fixes #292.
- [x] Include before/after visuals or gifs if this PR includes visual
changes.
- [x] Write tests for all new functionality: `enable line metrics for a
GeoJSON source` in `modals.spec.ts` (with an `enableLineMetrics` action
in the modal driver). It fails on `main`.
 - [x] Add an entry to `CHANGELOG.md` under the `## main` section.

Tested locally: `npm run lint` clean, `npx tsc --noEmit` clean, `npx
vitest run` (57 passed) and the full `npx playwright test` suite (221
passed). The new test fails when I put back `main`'s
`ModalSourcesTypeEditor.tsx`.

Assisted-By: Claude Opus 5.5 (Claude Code). It helped write the change,
the test and this description. I've reviewed and tested the change and
can answer questions about it.
2026-12-04 20:08:50 +02:00
..