aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/mapUtil.js
diff options
context:
space:
mode:
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),
+ }
+ }
+}