Rendering/parsing fails for files with `Infinity` in metadata `tilestats`

Aperta
#658 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
web-dev

Direzione di ricerca

Start by reproducing the failure with the provided PMTiles metadata snippet containing Infinity, using the TypeScript pmtiles library or pmtiles.io. Trace the metadata parsing path to identify where the non-strict JSON value causes loading to fail. Done means a PMTiles file with these tilestats values loads and renders successfully without manually editing the metadata.

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

Descrizione

Description

When a .pmtiles file contains Infinity as a value within the tilestats attribute of the metadata, the library fails to render the file.

The issue seems to probably stem from the fact that Infinity is not a valid value in strict JSON (while it's handled fine in Javascript), causing the parser to fail when reading the header/metadata. If the metadata is manually edited to replace Infinity with a standard numeric value (e.g. '99999'), the file renders perfectly.

The same file opens and displays correctly in QGIS, suggesting the underlying vector data is valid, but the JS-based metadata parsing is the bottleneck.

Environment
  • Library: pmtiles (NPM)
  • Platform: Web/Node.js
  • Version: 4.4.0
Steps to Reproduce
  1. Generate a PMTiles file where an attribute has an infinite value.
  2. Attempt to load/render this file using the library (or say pmtiles.io).
  3. Observe failure to render the file.
Metadata Snippet (Cause of failure)
{
  "tilestats": {
    "layers": [
      {
        "layer": "Detour Factor",
        "attributes": [
          {
            "attribute": "detour_factor",
            "type": "number",
            "values": [
              2.0198,
              ...,
              Infinity
            ],
            "min": 2.0198,
            "max": Infinity
          }
        ]
      }
    ]
  }
}
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.