A style beside a PMTiles overlay says how the map draws it (#963)

When a MapLibre style (and optionally a sprite sheet) sits beside a PMTiles file, the overlay is drawn with it instead of the generic colors: `<name>.style.json` and `<name>.sprite.json/.png`, or `style.json` and `sprite.json/.png` shared by the files of a directory.

Only the style's layers which draw that file are used; its sources, sprite and glyph URLs never are.  Fonts are replaced by the ones the map has, images are pointed at the overlay's own sprite (as strings, expressions or property functions), and each layer is validated so one the map could not draw is skipped instead of stopping the map.

The sprite is served by the API, which falls back to the single resolution sheet when there is no double resolution one.
This commit is contained in:
lrnselfreliance 2026-11-13 15:41:43 -07:00 • committed by GitHub
parent adb0adbd94
commit 4f58d2862f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 1003 additions and 12 deletions

View file

@ -49,6 +49,19 @@ async def post_file_visible(_: Request, body: schema.MapFileVisibleRequest):
return response.json({'error': 'File not found'}, HTTPStatus.NOT_FOUND)
@map_bp.get('/files/sprite/<name:path>')
@openapi.description("Get the sprite sheet beside a PMTiles map file: `<map file>[@2x].json` or `.png`")
async def get_file_sprite(_: Request, name: str):
try:
sprite = lib.get_sidecar_sprite_file(name)
except ValueError as e:
return response.json({'error': str(e)}, HTTPStatus.BAD_REQUEST)
if sprite:
return await response.file(sprite)
return response.json({'error': 'Sprite not found'}, HTTPStatus.NOT_FOUND)
@map_bp.get('/subscribe')
@openapi.description('Get map catalog and current subscriptions')
def get_subscriptions(request: Request):