forked from MapComplete/MapComplete
Chore: improve types, add checks
This commit is contained in:
parent
6e4879fb0d
commit
4b3e1fad4f
3 changed files with 17 additions and 10 deletions
|
|
@ -37,6 +37,7 @@ export class BBox {
|
|||
this.minLon = Math.min(coors[0], coors[2])
|
||||
this.maxLat = Math.max(coors[1], coors[3])
|
||||
this.minLat = Math.min(coors[1], coors[3])
|
||||
this.check()
|
||||
return
|
||||
}
|
||||
this.maxLat = -90
|
||||
|
|
@ -325,6 +326,11 @@ export class BBox {
|
|||
console.trace("BBox with NaN detected:", this)
|
||||
throw "BBOX has NAN"
|
||||
}
|
||||
if (this.minLat < -90 || this.maxLat > 90) {
|
||||
const msg = "Invalid BBOX detected: latitude is out of range. Did you swap lat & lon somewhere? min:" + this.minLat + "; max:" + this.maxLat
|
||||
console.trace(msg)
|
||||
throw msg
|
||||
}
|
||||
}
|
||||
|
||||
public overlapsWithFeature(f: Feature) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue