From fa5b92e6e115f4443cc8149f52763e33a7d75ef7 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 29 Mar 2021 02:05:11 +0200 Subject: [PATCH] Add link to nearby drinking water points with some fancy calculated tag magic --- Logic/GeoOperations.ts | 4 +--- Models/Constants.ts | 2 +- assets/layers/drinking_water/drinking_water.json | 9 +++++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Logic/GeoOperations.ts b/Logic/GeoOperations.ts index e239951cb..a687dee55 100644 --- a/Logic/GeoOperations.ts +++ b/Logic/GeoOperations.ts @@ -16,9 +16,7 @@ export class GeoOperations { } static centerpointCoordinates(feature: any){ - const coordinates = turf.center(feature).geometry.coordinates; - coordinates.reverse(); - return coordinates; + return turf.center(feature).geometry.coordinates; } /** diff --git a/Models/Constants.ts b/Models/Constants.ts index 44371d6ab..ef3f8eb5f 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import { Utils } from "../Utils"; 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 public static userJourney = { diff --git a/assets/layers/drinking_water/drinking_water.json b/assets/layers/drinking_water/drinking_water.json index b59d75494..5a057dbf2 100644 --- a/assets/layers/drinking_water/drinking_water.json +++ b/assets/layers/drinking_water/drinking_water.json @@ -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, "wayHandling": 1, "presets": [ @@ -122,6 +126,11 @@ } } ] + }, + { + "render":{ + "en": "The closest other drinking water fountain is {_closest_other_drinking_water_distance} meter" + } } ] } \ No newline at end of file