mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
warn if missing spec v2 metadata properties [#27]
This commit is contained in:
@@ -263,7 +263,7 @@ export class PMTiles {
|
|||||||
17 * header.root_entries
|
17 * header.root_entries
|
||||||
);
|
);
|
||||||
if (header.version === 1) {
|
if (header.version === 1) {
|
||||||
console.log("Sorting pmtiles v1 directory");
|
console.warn("Sorting pmtiles v1 directory");
|
||||||
root_dir = new DataView(sortDir(root_dir));
|
root_dir = new DataView(sortDir(root_dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,10 +287,25 @@ export class PMTiles {
|
|||||||
dec.decode(new DataView(root.buffer, 10, root.header.json_size))
|
dec.decode(new DataView(root.buffer, 10, root.header.json_size))
|
||||||
);
|
);
|
||||||
if (result.compression) {
|
if (result.compression) {
|
||||||
console.error(
|
console.warn(
|
||||||
`Archive has compression type: ${result.compression} and may not be readable directly by browsers.`
|
`Archive has compression type: ${result.compression} and may not be readable directly by browsers.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (!result.bounds) {
|
||||||
|
console.warn(
|
||||||
|
`Archive is missing 'bounds' in metadata, required in v2 and above.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!result.minzoom) {
|
||||||
|
console.warn(
|
||||||
|
`Archive is missing 'minzoom' in metadata, required in v2 and above.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!result.maxzoom) {
|
||||||
|
console.warn(
|
||||||
|
`Archive is missing 'maxzoom' in metadata, required in v2 and above.`
|
||||||
|
);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +319,7 @@ export class PMTiles {
|
|||||||
var buf = await resp.arrayBuffer();
|
var buf = await resp.arrayBuffer();
|
||||||
|
|
||||||
if (version === 1) {
|
if (version === 1) {
|
||||||
console.log("Sorting pmtiles v1 directory");
|
console.warn("Sorting pmtiles v1 directory.");
|
||||||
buf = sortDir(new DataView(buf));
|
buf = sortDir(new DataView(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user