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
- Generate a PMTiles file where an attribute has an infinite value.
- Attempt to load/render this file using the library (or say pmtiles.io).
- 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
}
]
}
]
}
}
Description
When a
.pmtilesfile containsInfinityas a value within thetilestatsattribute of the metadata, the library fails to render the file.The issue seems to probably stem from the fact that
Infinityis 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 replaceInfinitywith 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
pmtiles(NPM)Steps to Reproduce
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 } ] } ] } }