feat(rendering): add static map overlay endpoint#2794
Conversation
Performance Comparison
|
There was a problem hiding this comment.
Pull request overview
Adds static map rendering capabilities to Martin’s Linux-only rendering feature by introducing /style/{id}/static/... endpoints that render an image via maplibre-native and then draw optional path/marker overlays using tiny-skia. This also updates configuration + schema generation to include the new rendering surface area.
Changes:
- Add
GET/POST /style/{style_id}/static/{static_params}/{size_fmt}endpoints with query/body overlay parameters and image encoding. - Introduce overlay parsing/projection/bounds + drawing modules and add E2E/snapshot-style tests.
- Add a static render pool in
martin-coreand update OpenAPI/config schemas + docs to include rendering config/routes.
Reviewed changes
Copilot reviewed 20 out of 46 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| schemas/openapi.json | Documents new style rendering + static map endpoints and overlay schema. |
| schemas/config.json | Adds styles.rendering configuration schema (bool-or-object). |
| martin/tests/styles_server_test.rs | Adds E2E pixel-matching tests for the static endpoint and overlays. |
| martin/src/srv/styles_static.rs | Implements static map endpoints, request parsing/validation, overlay merge, and encoding. |
| martin/src/srv/styles_rendering.rs | Adjusts schema param handling for rendered tile endpoint. |
| martin/src/srv/static_overlay/project.rs | Adds Web Mercator projection helpers for overlay placement. |
| martin/src/srv/static_overlay/parse.rs | Adds parsers for path, marker, and paint/line style params. |
| martin/src/srv/static_overlay/mod.rs | Defines overlay types, defaults, and exports helpers. |
| martin/src/srv/static_overlay/draw.rs | Implements tiny-skia overlay drawing and snapshot tests. |
| martin/src/srv/static_overlay/bounds.rs | Computes overlay bounds and derives camera framing for auto mode. |
| martin/src/srv/server.rs | Registers static endpoints before the rendered-tile route to avoid routing conflicts. |
| martin/src/srv/mod.rs | Wires in styles_static and static_overlay under rendering (Linux-only). |
| martin/src/schemas.rs | Ensures rendering OpenAPI derive includes the new static endpoints. |
| martin/Cargo.toml | Extends rendering feature deps to include overlay/encoding dependencies and test deps. |
| martin-core/src/resources/styles/static_render_pool.rs | Adds a global single-worker static render pool with renderer/style caching. |
| martin-core/src/resources/styles/mod.rs | Exposes render_static and StaticRenderParams behind rendering (Linux-only). |
| martin-core/src/resources/styles/error.rs | Extends StyleError to include static render pool errors. |
| justfile | Updates gen-schemas to include rendering routes on Linux and sets MLN_PRECOMPILE=1. |
| docs/content/files/generated_config.md | Documents styles.rendering config in generated docs. |
| Cargo.toml | Adds workspace deps for overlay/rendering support crates. |
| Cargo.lock | Updates lockfile for new dependencies and version resolutions. |
283adf9 to
1bf0a66
Compare
nyurik
left a comment
There was a problem hiding this comment.
this is huge! And unlike experimental MLT, this is for a production system... can we somehow break it into smaller chunks?
Bigger issues:
- lots of dup code - ai was going all out on that
- is there a full doc on all functionality? I'm not yet convinced google polyline is the right approach
- should we support geojson with styling approach as used in https://geojson.io/next -- this would be far cleaner imo, rather than reinventing this language
Also, is this all still part of experimental, or is this built by default?
It is not reinventing a language. The entire API is modeled off what seems to work already. I have not heard of the simplestyle apprach, that is one alternative of doing it, but an editor comes later for this. |
3243bea to
ce1894a
Compare
d45545f to
6ad6337
Compare
7106ff4 to
6804e09
Compare
…uashed # Conflicts: # Cargo.toml # martin-core/Cargo.toml # martin-core/src/resources/styles/mod.rs # martin-core/src/resources/styles/render_pool.rs # martin/src/config/file/error.rs # martin/src/config/file/resources/styles.rs
Adds two new HTTP endpoints under our rendering feature:
POST /style/{id}/static/{camera}/{wxh.fmt}-> render a static map image at a center point, bounding box, or auto-fit to overlays.static_overlaymodule then draws withtiny-skiaover the rendered map.