Scripts(community_index): create script to update community index files, create weekly data maintenance script

This commit is contained in:
Pieter Vander Vennet 2025-01-27 02:32:19 +01:00
parent 36a9b49c66
commit 7bddaa7d4c
11 changed files with 412 additions and 141 deletions

View file

@ -1,4 +1,5 @@
import { BBox } from "../Logic/BBox"
import { Feature, Polygon } from "geojson"
export interface TileRange {
xstart: number
@ -80,6 +81,17 @@ export class Tiles {
return [z, x, index % factor]
}
static asGeojson(index: number): Feature<Polygon>;
static asGeojson(x: number, y: number, z: number): Feature<Polygon>;
static asGeojson(zIndex: number, x?: number, y?: number): Feature<Polygon> {
let z = zIndex
if (x === undefined) {
[z, x, y] = Tiles.tile_from_index(zIndex)
}
const bounds = Tiles.tile_bounds_lon_lat(z, x, y)
return new BBox(bounds).asGeoJson()
}
/**
* Return x, y of the tile containing (lat, lon) on the given zoom level
*/