docs: improve typing

This commit is contained in:
Pieter Vander Vennet 2023-03-11 02:34:47 +01:00
parent ab7077d5dd
commit 750a0620e9

View file

@ -1,6 +1,7 @@
import * as turf from "@turf/turf" import * as turf from "@turf/turf"
import { TileRange, Tiles } from "../Models/TileRange" import { TileRange, Tiles } from "../Models/TileRange"
import { GeoOperations } from "./GeoOperations" import { GeoOperations } from "./GeoOperations"
import { Feature, Polygon } from "geojson"
export class BBox { export class BBox {
static global: BBox = new BBox([ static global: BBox = new BBox([
@ -185,11 +186,16 @@ export class BBox {
] ]
} }
asGeoJson(properties: any): any { public asGeoJson<T>(properties: T): Feature<Polygon, T> {
return { return {
type: "Feature", type: "Feature",
properties: properties, properties: properties,
geometry: { geometry: this.asGeometry(),
}
}
public asGeometry(): Polygon {
return {
type: "Polygon", type: "Polygon",
coordinates: [ coordinates: [
[ [
@ -200,7 +206,6 @@ export class BBox {
[this.minLon, this.minLat], [this.minLon, this.minLat],
], ],
], ],
},
} }
} }