forked from MapComplete/MapComplete
		
	Add link to nearby drinking water points with some fancy calculated tag magic
This commit is contained in:
		
							parent
							
								
									bec1998a6d
								
							
						
					
					
						commit
						fa5b92e6e1
					
				
					 3 changed files with 11 additions and 4 deletions
				
			
		|  | @ -16,9 +16,7 @@ export class GeoOperations { | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     static centerpointCoordinates(feature: any){ |     static centerpointCoordinates(feature: any){ | ||||||
|         const coordinates = turf.center(feature).geometry.coordinates; |         return turf.center(feature).geometry.coordinates; | ||||||
|         coordinates.reverse(); |  | ||||||
|         return coordinates; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ import { Utils } from "../Utils"; | ||||||
| 
 | 
 | ||||||
| export default class Constants { | export default class Constants { | ||||||
|      |      | ||||||
|     public static vNumber = "0.6.3"; |     public static vNumber = "0.6.4"; | ||||||
| 
 | 
 | ||||||
|     // The user journey states thresholds when a new feature gets unlocked
 |     // The user journey states thresholds when a new feature gets unlocked
 | ||||||
|     public static userJourney = { |     public static userJourney = { | ||||||
|  |  | ||||||
|  | @ -41,6 +41,10 @@ | ||||||
|       ] |       ] | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |   "calculatedTags": [ | ||||||
|  |     "_closest_other_drinking_water_id=feat.closest('drinking_water').id", | ||||||
|  |     "_closest_other_drinking_water_distance=Math.floor(feat.distanceTo(feat.closest('drinking_water')) * 1000)" | ||||||
|  |   ], | ||||||
|   "minzoom": 13, |   "minzoom": 13, | ||||||
|   "wayHandling": 1, |   "wayHandling": 1, | ||||||
|   "presets": [ |   "presets": [ | ||||||
|  | @ -122,6 +126,11 @@ | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|       ] |       ] | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "render":{ | ||||||
|  |         "en": "<a href='#{_closest_other_drinking_water_id}'>The closest other drinking water fountain is {_closest_other_drinking_water_distance} meter</a>" | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   ] |   ] | ||||||
| } | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue