aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/mapUtil.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-10-25 15:59:38 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-10-25 15:59:38 -0700
commit5df4c5743d7b501529d4e3823fe02184ef0259fe (patch)
tree646bb68e91595035aa589c120f81880f2f18987b /modern/src/map/mapUtil.js
parent2184bb6a9e98327f7d756b5977ae5315268f37b3 (diff)
downloadtrackermap-web-5df4c5743d7b501529d4e3823fe02184ef0259fe.tar.gz
trackermap-web-5df4c5743d7b501529d4e3823fe02184ef0259fe.tar.bz2
trackermap-web-5df4c5743d7b501529d4e3823fe02184ef0259fe.zip
Initial geofence implementation
Diffstat (limited to 'modern/src/map/mapUtil.js')
-rw-r--r--modern/src/map/mapUtil.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/modern/src/map/mapUtil.js b/modern/src/map/mapUtil.js
index 614234b5..71d7b3c9 100644
--- a/modern/src/map/mapUtil.js
+++ b/modern/src/map/mapUtil.js
@@ -50,3 +50,20 @@ export const calculateBounds = features => {
return null;
}
}
+
+export const reverseCoordinates = it => {
+ if (!it) {
+ return it;
+ } else if (Array.isArray(it)) {
+ if (it.length === 2 && !Number.isNaN(it[0]) && !Number.isNaN(it[1])) {
+ return [it[1], it[0]];
+ } else {
+ return it.map(it => reverseCoordinates(it));
+ }
+ } else {
+ return {
+ ...it,
+ coordinates: reverseCoordinates(it.coordinates),
+ }
+ }
+}