forked from MapComplete/MapComplete
docs: improve typing
This commit is contained in:
parent
ab7077d5dd
commit
750a0620e9
1 changed files with 17 additions and 12 deletions
|
@ -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,22 +186,26 @@ 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(),
|
||||||
type: "Polygon",
|
}
|
||||||
coordinates: [
|
}
|
||||||
[
|
|
||||||
[this.minLon, this.minLat],
|
public asGeometry(): Polygon {
|
||||||
[this.maxLon, this.minLat],
|
return {
|
||||||
[this.maxLon, this.maxLat],
|
type: "Polygon",
|
||||||
[this.minLon, this.maxLat],
|
coordinates: [
|
||||||
[this.minLon, this.minLat],
|
[
|
||||||
],
|
[this.minLon, this.minLat],
|
||||||
|
[this.maxLon, this.minLat],
|
||||||
|
[this.maxLon, this.maxLat],
|
||||||
|
[this.minLon, this.maxLat],
|
||||||
|
[this.minLon, this.minLat],
|
||||||
],
|
],
|
||||||
},
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue