Many tweaks to use MC in an iframe with less clutter

This commit is contained in:
Pieter Vander Vennet 2024-06-27 17:37:34 +02:00
parent 894b0d45ca
commit f88cb9a730
19 changed files with 384 additions and 236 deletions

View file

@ -51,7 +51,7 @@ export class SummaryTileSourceRewriter implements FeatureSource {
...f.properties,
id: f.properties.id + bitmap,
total: newTotal,
total_metric: Utils.numberWithMetrixPrefix(newTotal),
total_metric: Utils.numberWithMetricPrefix(newTotal),
},
})
fullTotal += newTotal
@ -101,12 +101,12 @@ export class SummaryTileSource extends DynamicTileSource {
return SummaryTileSource.empty
}
const counts = count["success"]
if (counts === undefined || counts["total"] === 0) {
const total = Number(counts?.["total"] ?? 0)
if (total === 0) {
return SummaryTileSource.empty
}
const lat = counts["lat"]
const lon = counts["lon"]
const total = Number(counts["total"])
const tileBbox = new BBox(Tiles.tile_bounds_lon_lat(z, x, y))
if (!tileBbox.contains([lon, lat])) {
console.error(
@ -128,7 +128,7 @@ export class SummaryTileSource extends DynamicTileSource {
summary: "yes",
...counts,
total,
total_metric: Utils.numberWithMetrixPrefix(total),
total_metric: Utils.numberWithMetricPrefix(total),
layers: layersSummed,
},
geometry: {