From fe2a6ca065b8ace2f466a6cac549f6d84ee35044 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 12 Dec 2024 01:54:36 +0100 Subject: [PATCH] Fix: fix #2309 --- src/Logic/BBox.ts | 9 +++++---- src/Logic/GeoOperations.ts | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Logic/BBox.ts b/src/Logic/BBox.ts index 5077842ee..000dd5463 100644 --- a/src/Logic/BBox.ts +++ b/src/Logic/BBox.ts @@ -68,16 +68,17 @@ export class BBox { * */ static get(feature: Feature): BBox { - const f = feature - if (f.bbox?.overlapsWith === undefined) { + if (feature.bbox?.["overlapsWith"] === undefined) { const [minX, minY, maxX, maxY]: number[] = turf.bbox(feature) // Note: x is longitude - f["bbox"] = new BBox([ + // @ts-ignore + feature["bbox"] = new BBox([ [minX, minY], [maxX, maxY], ]) } - return f["bbox"] + // @ts-ignore + return feature["bbox"] } static bboxAroundAll(bboxes: BBox[]): BBox { diff --git a/src/Logic/GeoOperations.ts b/src/Logic/GeoOperations.ts index be0657cc4..e0bca689c 100644 --- a/src/Logic/GeoOperations.ts +++ b/src/Logic/GeoOperations.ts @@ -10,12 +10,13 @@ import { MultiPolygon, Point, Polygon, - Position, + Position } from "geojson" import { Tiles } from "../Models/TileRange" import { Utils } from "../Utils" import { NearestPointOnLine } from "@turf/nearest-point-on-line" -;("use strict") + +("use strict") export class GeoOperations { private static readonly _earthRadius = 6378137 @@ -365,6 +366,7 @@ export class GeoOperations { ): Feature { if (way.geometry.type === "Polygon") { return >{ + type: "Feature", geometry: { type: "LineString", coordinates: way.geometry.coordinates[0], @@ -374,6 +376,7 @@ export class GeoOperations { } if (way.geometry.type === "MultiPolygon") { return >{ + type: "Feature", geometry: { type: "MultiLineString", coordinates: way.geometry.coordinates[0],