Fix: fix nearby drinking water fountain detection

This commit is contained in:
Pieter Vander Vennet 2024-01-22 04:29:51 +01:00
parent ddfb7988ed
commit 13ebcffab1
2 changed files with 20 additions and 14 deletions

View file

@ -258,24 +258,29 @@ class ClosestNObjectFunc implements ExtraFunction {
const maxFeatures = options?.maxFeatures ?? 1
const maxDistance = options?.maxDistance ?? 500
const uniqueTag: string | undefined = options?.uniqueTag
let allFeatures: Feature[][]
if (typeof features === "string") {
features = [features]
} else {
allFeatures = []
for (const spec of features) {
if (typeof spec === "string") {
const name = spec
const bbox = GeoOperations.bbox(
GeoOperations.buffer(GeoOperations.bbox(feature), maxDistance)
)
const coors = <[number, number][]>bbox.geometry.coordinates
allFeatures.push(...params.getFeaturesWithin(name, new BBox(coors)))
} else {
allFeatures.push([spec])
}
}
let allFeatures: Feature[][] = []
for (const spec of features) {
if (typeof spec === "string") {
const name = spec
const bbox = GeoOperations.bbox(
GeoOperations.buffer(GeoOperations.bbox(feature), maxDistance)
)
const coors = <[number, number][]>bbox.geometry.coordinates
allFeatures.push(...params.getFeaturesWithin(name, new BBox(coors)))
} else {
allFeatures.push([spec])
}
}
console.log(
"Determining features which are close to",
features,
"other features:",
allFeatures
)
if (features === undefined) {
return
}

View file

@ -19,6 +19,7 @@
import { LayoutInformation } from "../Models/ThemeConfig/LayoutConfig"
import * as themeOverview from "../assets/generated/theme_overview.json"
import UnofficialThemeList from "./BigComponents/UnofficialThemeList.svelte"
import Eye from "../assets/svg/Eye.svelte"
const featureSwitches = new OsmConnectionFeatureSwitches()
const osmConnection = new OsmConnection({