Protocol: add `encoding: "mlt"` to the TileJSON for MLT archives

Aperta
#692 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@tordans ci sta già lavorando.

Dal 25/11/2026.

  • #693 di @tordans — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
15/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
api

Direzione di ricerca

The change belongs where Protocol builds TileJSON: the type: "json" path of tilev4 and getTileJson, both of which read the archive header. Set encoding from header.tileType (TileType.Mlt gives "mlt", otherwise "mvt") in both places, then check that MVT output is unchanged. This already has an open linked pull request (#693), so review that work rather than starting a new change.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I am migrating our PMTiles from MVT to MLT by switching from tippecanoe to manby, to take advantage of the smaller file sizes.

I noticed that I have to do additional work to pass the encoding on to MapLibre, like you did for the viewer in #647. The header already has tileType: 6, but the TileJSON that Protocol returns has no encoding, so MapLibre decodes the tiles as MVT.

Could Protocol add encoding to the TileJSON based on the tile type, so apps don't have to set it themselves?

Details by Claude

Written by Claude Opus 5.5 (effort: medium);

Problem

For an archive with tile type 6 (MLT), MapLibre GL JS decodes the tiles as MVT unless the source sets encoding: "mlt". Protocol reads the header, but the TileJSON it returns for type: "json" has no encoding, with or without metadata: true (getTileJson). So every app has to read the header itself and set the encoding on each source. Apps that load MVT and MLT archives side by side need this per file.

Proposal

Add encoding to the TileJSON in both the type: "json" path of tilev4 and in getTileJson:

encoding: header.tileType === TileType.Mlt ? "mlt" : "mvt"

MapLibre GL JS reads encoding from the TileJSON (load_tilejson.ts), and an encoding set on the source still wins. Existing MVT setups are unaffected.

encoding is a source property in the MapLibre style spec, not part of TileJSON 3.0.0. MapLibre still expects it in the TileJSON for MLT sources (maplibre/maplibre-gl-js#6882, the demotiles do the same).

Workaround we use today

A wrapper around protocol.tilev4 that adds encoding to the TileJSON after reading the header via protocol.get(url).getHeader().


Update: There is now https://github.com/protomaps/PMTiles/pull/693

Lingua principale
TypeScript
Stelle
3.3k
Fork
218
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di protomaps/PMTiles

Tutte le issue di protomaps/PMTiles

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.