forked from MapComplete/MapComplete
		
	Fix: fix nearby drinking water fountain detection
This commit is contained in:
		
							parent
							
								
									bb9b51e5f7
								
							
						
					
					
						commit
						a5276eb4e6
					
				
					 2 changed files with 20 additions and 14 deletions
				
			
		|  | @ -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 | ||||
|         } | ||||
|  |  | |||
|  | @ -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({ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue