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

View file

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