changeset 669:7022a92e1314 octree

Merged default into octree branch.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 19 Sep 2018 10:50:47 +0200
parents 7345a249c9e1 (current diff) 3e2eeb215d0e (diff)
children be0327dc3119
files
diffstat 7 files changed, 537 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/application/Sidebar.vue	Tue Sep 18 13:41:20 2018 +0200
+++ b/client/src/application/Sidebar.vue	Wed Sep 19 10:50:47 2018 +0200
@@ -79,7 +79,7 @@
 .sidebarcollapsed {
   height: 30px;
   width: 30px;
-  transition: $slight-transparent;
+  transition: $transition-fast;
 }
 
 .sidebarextended {
--- a/client/src/application/Topbar.vue	Tue Sep 18 13:41:20 2018 +0200
+++ b/client/src/application/Topbar.vue	Wed Sep 19 10:50:47 2018 +0200
@@ -1,32 +1,37 @@
 <template>
-    <div class="topbar d-flex flex-row justify-content-between">
+    <div class="topbar d-flex flex-row">
         <div @click="toggleSidebar">
             <i class="ui-element menubutton fa fa-bars"></i>
         </div>
-        <div v-if="routeName != 'usermanagement'" class="input-group searchcontainer">
+        <div v-if="routeName != 'usermanagement'" :class="searchbarContainerStyle">
             <div class="input-group-prepend shadow">
-                <span class="input-group-text searchlabel" for="search">
+                <span @click="toggleSearchbar" class="ui-element input-group-text searchlabel" for="search">
                     <i class="fa fa-search"></i>
                 </span>
             </div>
-            <input id="search" type="text" class="form-control ui-element search searchbar">
+            <input v-if="!searchbarCollapsed" id="search" type="text" class="form-control ui-element search searchbar">
         </div>
-        <div v-if="routeName != 'usermanagement'">
+        <div v-if="routeName != 'usermanagement'" class="splitbutton">
             <i @click="splitScreen" class="ui-element splitscreen fa fa-window-restore shadow"></i>
         </div>
-        <Layers v-if="routeName != 'usermanagement'"></Layers>
+        <div class="">
+            <Layers v-if="routeName != 'usermanagement'"></Layers>
+        </div>
     </div>
 </template>
 
 <style lang="scss">
+.splitbutton {
+  height: $icon-height;
+}
 .splitscreen {
   background-color: white;
   padding: $small-offset;
   margin-right: $small-offset;
   margin-left: $offset;
   border-radius: $border-radius;
-  height: $icon-width;
-  width: $icon-height;
+  height: $icon-height;
+  width: $icon-width;
 }
 
 .menubutton {
@@ -34,22 +39,36 @@
   padding: $small-offset;
   border-radius: $border-radius;
   margin-left: $offset;
-  height: $icon-width;
-  width: $icon-height;
+  height: $icon-height;
+  width: $icon-width;
 }
 
 .searchcontainer {
-  margin-left: 20vw;
+  height: $icon-height;
+  border-radius: 0.25rem;
+}
+
+.searchbar-expanded {
+  margin-left: 22vw;
   margin-right: auto;
-  width: 50vw !important;
-  height: 39px;
-  border-radius: 0.25rem;
+  width: $searchbar-width !important;
+}
+
+.searchbar-collapsed {
+  margin-left: auto;
+  margin-right: $small-offset;
+  width: $icon-width !important;
+  transition: $transition-fast;
 }
 
 .searchbar {
   margin-left: auto;
   margin-right: auto;
-  height: 50px;
+  height: $icon-height !important;
+}
+
+.searchlabel {
+  background-color: white !important;
 }
 
 .topbar {
@@ -71,8 +90,26 @@
   components: {
     Layers: Layers
   },
+  data() {
+    return {
+      searchbarCollapsed: false
+    };
+  },
+  computed: {
+    searchbarContainerStyle() {
+      return {
+        "input-group": true,
+        searchcontainer: true,
+        "searchbar-collapsed": this.searchbarCollapsed,
+        "searchbar-expanded": !this.searchbarCollapsed
+      };
+    }
+  },
   props: ["routeName"],
   methods: {
+    toggleSearchbar() {
+      this.searchbarCollapsed = !this.searchbarCollapsed;
+    },
     toggleSidebar() {
       this.$store.commit("application/toggleSidebar");
     },
--- a/client/src/application/assets/application.scss	Tue Sep 18 13:41:20 2018 +0200
+++ b/client/src/application/assets/application.scss	Wed Sep 19 10:50:47 2018 +0200
@@ -17,6 +17,7 @@
 $layerselect-height: 20rem;
 $layerselect-width: 20rem;
 $slight-transparent: 0.96;
+$searchbar-width: 50vw;
 
 .debug {
   border: 1px solid red;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/application/lib/geo.js	Wed Sep 19 10:50:47 2018 +0200
@@ -0,0 +1,136 @@
+/**
+ *
+ * Distance calculations
+ * JS transposition of cross.go functions
+ *
+ */
+
+const EARTHRADIUS = 6378137.0;
+
+/**
+ * Converts to radiant
+ * @param {degree} d
+ */
+const deg2rad = d => {
+  return (d * Math.PI) / 180.0;
+};
+
+/**
+ * Calculates the difference between two points in m
+ *
+ * Points are given with {lat: $lat, lon: $lon}
+ *
+ * @param {object} P1
+ * @param {object} P2
+ */
+const distanceBetween = (P1, P2) => {
+  const dLat = deg2rad(P2.lat - P1.lat);
+  let dLng = Math.abs(deg2rad(P2.lon - P1.lon));
+  if (dLng > Math.PI) {
+    dLng = 2 * Math.PI - dLng;
+  }
+  const x = dLng * Math.cos(deg2rad((P1.lat + P2.lat) / 2.0));
+  return Math.sqrt(dLat * dLat + x * x) * EARTHRADIUS;
+};
+
+/**
+ * Takes a triple of [lat, long, alt] and generates
+ * an object with according attributes
+ * {
+ *  lat: $lat,
+ *  lon: $lon,
+ *  alt: $alt
+ * }
+ *
+ * @param {array} coords
+ */
+const generatePoint = coords => {
+  return {
+    lon: coords[0],
+    lat: coords[1],
+    alt: coords[2]
+  };
+};
+
+/**
+ * Has geoJSON as its input and transforms
+ * given coordinates
+ *
+ * a) extracting the minimum altitude
+ * b) extracting the maximum altitude
+ * c) calculating the total length of the given profile
+ * d) transposes the datapoints given to the first point of the first section
+ *
+ * @param {object} feature
+ */
+const transform = feature => {
+  const sections = feature.geometry.coordinates;
+  let firstPoint = generatePoint(sections[0][0]);
+  let coordinates = [];
+  let totalLength = 0;
+  let minAlt = firstPoint.alt;
+  let maxAlt = firstPoint.alt;
+  for (let section of sections) {
+    let sectionCoordinates = [];
+    let previousPoint = generatePoint(section[0]);
+    for (let coords of section) {
+      const currentPoint = generatePoint(coords);
+      let x = distanceBetween(firstPoint, currentPoint);
+      let y = coords[2];
+      sectionCoordinates.push({
+        x: x,
+        y: y
+      });
+      totalLength += distanceBetween(currentPoint, previousPoint);
+      previousPoint = currentPoint;
+      if (y < minAlt) minAlt = y;
+      if (y > maxAlt) maxAlt = y;
+    }
+    coordinates.push(sectionCoordinates);
+  }
+  return { coordinates, totalLength, minAlt, maxAlt };
+};
+
+/**
+ * Prepare profile takes geoJSON data in form of
+ * a MultiLineString, e.g.
+ *
+ * {
+ *   type: "Feature",
+ *   geometry: {
+ *   type: "MultiLineString",
+ *   coordinates: [
+ *                 [
+ *                  [16.53593398, 48.14694085, -146.52392755]
+ *                  ...
+ *                  ]]
+ *
+ * and transforms it to a structure representing the number of sections
+ * where data is present with according lengths and the points
+ *
+ * {
+ *  { points:
+ *           [
+ *            [ { x: 0.005798201616417183, y: -146.52419461 },
+ *              { x: 0, y: -146.52394016 }
+ *              ...
+ *            ]
+ *           ]
+ *   totalLength: 160.06814078495722,
+ *   minAlt: -146.73122231,
+ *   maxAlt: -145.65155866
+ *  }
+ *
+ * @param {object} geoJSON
+ */
+const prepareProfile = geoJSON => {
+  const { coordinates, totalLength, minAlt, maxAlt } = transform(geoJSON);
+  return {
+    points: coordinates,
+    totalLength: totalLength,
+    minAlt: minAlt,
+    maxAlt: maxAlt
+  };
+};
+
+export { prepareProfile };
--- a/client/src/layers/Layers.vue	Tue Sep 18 13:41:20 2018 +0200
+++ b/client/src/layers/Layers.vue	Wed Sep 19 10:50:47 2018 +0200
@@ -1,5 +1,5 @@
 <template>
-    <div>
+    <div class="layerselectmenu">
         <div @click="collapse" class="d-flex flex-column ui-element minimizer">
             <div>
                 <i class="fa fa-th-list"></i>
@@ -20,6 +20,10 @@
 </template>
 
 <style lang="scss">
+.layerselectmenu {
+  position: relative;
+  margin-right: $offset;
+}
 .layerselection {
   background-color: white;
   margin-left: $small-offset;
@@ -40,13 +44,9 @@
 .minimizer {
   position: absolute;
   z-index: 2;
-  right: $offset;
-  background-color: white;
+  right: 0;
+  margin-top: $x-small-offset;
   border-radius: $border-radius;
-  padding-left: $small-offset;
-  padding-right: $small-offset;
-  padding-top: $x-small-offset;
-  margin-left: $offset;
   height: $icon-width;
   width: $icon-height;
 }
--- a/client/src/map/Maplayer.vue	Tue Sep 18 13:41:20 2018 +0200
+++ b/client/src/map/Maplayer.vue	Wed Sep 19 10:50:47 2018 +0200
@@ -202,7 +202,7 @@
 
     // FIXME this is hardwired for now
     var featureRequest6 = new WFS().writeGetFeature({
-      srsName: "EPSG:4326",
+      srsName: "EPSG:3857",
       featureNS: "gemma",
       featurePrefix: "gemma",
       featureTypes: ["distance_marks"],
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/tests/unit/geo/geo.spec.js	Wed Sep 19 10:50:47 2018 +0200
@@ -0,0 +1,339 @@
+import { prepareProfile } from "../../../src/application/lib/geo";
+
+const demodata = {
+  type: "Feature",
+  geometry: {
+    type: "MultiLineString",
+    coordinates: [
+      [
+        [16.53593398, 48.14694085, -146.52392755],
+        [16.53593417, 48.14694103, -146.5237491],
+        [16.53593457, 48.14694143, -146.52359203],
+        [16.53593489, 48.14694174, -146.52171935],
+        [16.53593523, 48.14694207, -146.51977101],
+        [16.53593887, 48.14694566, -146.49861321],
+        [16.53595008, 48.1469567, -146.56072465],
+        [16.5359517, 48.1469583, -146.59398689],
+        [16.5359565, 48.14696303, -146.52466904],
+        [16.53595674, 48.14696326, -146.52175781],
+        [16.53595749, 48.14696401, -146.525045],
+        [16.53595771, 48.14696422, -146.53622053],
+        [16.535959, 48.1469655, -146.56556928],
+        [16.53596177, 48.14696823, -146.61177352],
+        [16.53596357, 48.14697, -146.61357383],
+        [16.53597, 48.14697633, -146.60860496],
+        [16.53597247, 48.14697876, -146.60175292],
+        [16.53598128, 48.14698744, -146.6],
+        [16.53598388, 48.14699, -146.59612416],
+        [16.53598696, 48.14699304, -146.58908826],
+        [16.53599403, 48.147, -146.57086913],
+        [16.53599604, 48.14700198, -146.57093378],
+        [16.536, 48.14700588, -146.57135537],
+        [16.5360058, 48.1470116, -146.5773355],
+        [16.53601143, 48.14701714, -146.586],
+        [16.53601287, 48.14701856, -146.58886644],
+        [16.53601433, 48.14702, -146.59284396],
+        [16.53602222, 48.14702778, -146.60933389],
+        [16.53603, 48.14703544, -146.62017521],
+        [16.5360323, 48.1470377, -146.62062115],
+        [16.53604, 48.14704529, -146.63128926],
+        [16.53604237, 48.14704763, -146.63149126],
+        [16.53604478, 48.14705, -146.63934732],
+        [16.53604741, 48.14705259, -146.65491174],
+        [16.53605, 48.14705514, -146.65739339],
+        [16.53605749, 48.14706251, -146.672801],
+        [16.53606, 48.14706499, -146.6809719],
+        [16.53606508, 48.14707, -146.69240772],
+        [16.53607, 48.14707484, -146.69232727],
+        [16.5360726, 48.1470774, -146.6917652],
+        [16.53607523, 48.14708, -146.69224161],
+        [16.53608063, 48.14708532, -146.69853152],
+        [16.53608539, 48.14709, -146.70246057],
+        [16.53608694, 48.14709153, -146.70221369],
+        [16.53609, 48.14709455, -146.71036364],
+        [16.53609554, 48.1471, -146.72067785],
+        [16.53609779, 48.14710221, -146.71622814],
+        [16.5361, 48.1471044, -146.71624132],
+        [16.53610786, 48.14711214, -146.73122231],
+        [16.53611, 48.14711425, -146.72638017],
+        [16.53611584, 48.14712, -146.71316779],
+        [16.53612, 48.1471241, -146.69596364],
+        [16.53612297, 48.14712703, -146.66881099],
+        [16.53612599, 48.14713, -146.65981711],
+        [16.53613216, 48.14713608, -146.67],
+        [16.53613614, 48.14714, -146.66614094],
+        [16.53613808, 48.14714192, -146.66425479],
+        [16.53614, 48.1471438, -146.67],
+        [16.53614816, 48.14715184, -146.67815987],
+        [16.53615, 48.14715365, -146.68],
+        [16.53615823, 48.14716177, -146.63882598],
+        [16.53616, 48.1471635, -146.63350413],
+        [16.53616831, 48.14717169, -146.65],
+        [16.53617, 48.14717336, -146.64949669],
+        [16.53617558, 48.14717885, -146.65424862],
+        [16.53618, 48.14718321, -146.62038017],
+        [16.53618342, 48.14718658, -146.60855537],
+        [16.5361869, 48.14719, -146.61379195],
+        [16.53618846, 48.14719154, -146.61845962],
+        [16.53619, 48.14719306, -146.62305785],
+        [16.53619853, 48.14720147, -146.62975853],
+        [16.5362, 48.14720291, -146.62538182],
+        [16.53620357, 48.14720643, -146.62185762],
+        [16.5362072, 48.14721, -146.62583809],
+        [16.53621151, 48.14721425, -146.63035726],
+        [16.53621735, 48.14722, -146.63734899],
+        [16.53621868, 48.14722132, -146.63802664],
+        [16.53622, 48.14722261, -146.63529917],
+        [16.53622876, 48.14723124, -146.65217652],
+        [16.53623, 48.14723246, -146.6538281],
+        [16.5362338, 48.1472362, -146.63837968],
+        [16.53623765, 48.14724, -146.62690604],
+        [16.53624554, 48.14724777, -146.62013288],
+        [16.53624891, 48.14725109, -146.61249126],
+        [16.53625, 48.14725217, -146.61326777],
+        [16.53625898, 48.14726102, -146.59450791],
+        [16.53626, 48.14726202, -146.5974281],
+        [16.5362681, 48.14727, -146.58668792],
+        [16.53626906, 48.14727094, -146.58335221],
+        [16.53627, 48.14727187, -146.5729686],
+        [16.53627913, 48.14728087, -146.5443239],
+        [16.53628, 48.14728172, -146.54074876],
+        [16.53628921, 48.14729079, -146.48338968],
+        [16.53629856, 48.1473, -146.38062752],
+        [16.53629904, 48.14730048, -146.37768002],
+        [16.5363, 48.14730142, -146.37599504],
+        [16.53630578, 48.14730711, -146.36669282],
+        [16.53630871, 48.14731, -146.35761745],
+        [16.5363144, 48.1473156, -146.3226378],
+        [16.53631886, 48.14732, -146.31291275],
+        [16.53631943, 48.14732057, -146.31279267],
+        [16.53632, 48.14732112, -146.31115702],
+        [16.53632951, 48.14733049, -146.30270525],
+        [16.53633096, 48.14733192, -146.29954072],
+        [16.53634462, 48.14734538, -146.27439384],
+        [16.53634931, 48.14735, -146.27538087],
+        [16.53635, 48.14735068, -146.27589835],
+        [16.53635973, 48.14736027, -146.28857369],
+        [16.53636, 48.14736053, -146.28857686],
+        [16.53636981, 48.14737019, -146.24847877],
+        [16.53637, 48.14737038, -146.24739174],
+        [16.53637977, 48.14738, -146.22614094],
+        [16.53637988, 48.14738012, -146.22580183],
+        [16.53638, 48.14738023, -146.22602314],
+        [16.53639331, 48.14739334, -146.22267557],
+        [16.5364, 48.14739993, -146.2368876],
+        [16.53640004, 48.14739998, -146.23699777],
+        [16.53640007, 48.1474, -146.23698322],
+        [16.53640014, 48.14740007, -146.23727257],
+        [16.53641022, 48.14741, -146.26819631],
+        [16.53641515, 48.14741485, -146.31195087],
+        [16.53642, 48.14741964, -146.37529091],
+        [16.53642037, 48.14742, -146.37933221],
+        [16.53642682, 48.14742636, -146.38609302],
+        [16.53643935, 48.1474387, -146.41230619],
+        [16.53644033, 48.14743967, -146.41376686],
+        [16.53644067, 48.14744, -146.41634899],
+        [16.53645, 48.14744919, -146.47657025],
+        [16.53645041, 48.14744959, -146.47965279],
+        [16.53645082, 48.14745, -146.48352181],
+        [16.53645545, 48.14745455, -146.5094055],
+        [16.53646, 48.14745904, -146.49783471],
+        [16.53646097, 48.14746, -146.49497315],
+        [16.53646552, 48.14746448, -146.50668776],
+        [16.53647, 48.14746889, -146.50222149],
+        [16.5364756, 48.1474744, -146.48545212],
+        [16.53648128, 48.14748, -146.45715436],
+        [16.53648421, 48.14748289, -146.4430985],
+        [16.53649, 48.1474886, -146.46353719],
+        [16.53649143, 48.14749, -146.46572148],
+        [16.53649575, 48.14749425, -146.44],
+        [16.53650158, 48.1475, -146.41105705],
+        [16.53650722, 48.14750556, -146.40139646],
+        [16.53651451, 48.14751274, -146.40124819],
+        [16.53652, 48.14751815, -146.39814876],
+        [16.53652093, 48.14751907, -146.4],
+        [16.53652188, 48.14752, -146.39624161],
+        [16.53653, 48.147528, -146.3936],
+        [16.53653101, 48.14752899, -146.39629475],
+        [16.53653203, 48.14753, -146.39628943],
+        [16.53653808, 48.14753596, -146.39178798],
+        [16.53655, 48.1475477, -146.41301322],
+        [16.53655077, 48.14754846, -146.41553821],
+        [16.53655233, 48.14755, -146.41693289],
+        [16.53656, 48.14755755, -146.40640331],
+        [16.53656248, 48.14756, -146.41292617],
+        [16.53656627, 48.14756373, -146.43630142],
+        [16.53657, 48.1475674, -146.42674711],
+        [16.53657131, 48.14756869, -146.42496753],
+        [16.53657263, 48.14757, -146.41736577],
+        [16.53658, 48.14757726, -146.4172562],
+        [16.53658185, 48.14757908, -146.41907624],
+        [16.53658279, 48.14758, -146.41721477],
+        [16.53659146, 48.14758854, -146.41708576],
+        [16.5366, 48.14759696, -146.3923686],
+        [16.53660153, 48.14759847, -146.39084679],
+        [16.53660309, 48.1476, -146.39238926],
+        [16.53660878, 48.14760561, -146.39495159],
+        [16.53662, 48.14761666, -146.36917686],
+        [16.53662168, 48.14761832, -146.37090508],
+        [16.53663, 48.14762651, -146.37284711],
+        [16.53663176, 48.14762824, -146.36781099],
+        [16.53664, 48.14763636, -146.39327273],
+        [16.53664183, 48.14763817, -146.39178684],
+        [16.53664369, 48.14764, -146.38843289],
+        [16.5366475, 48.14764375, -146.37763543],
+        [16.53665384, 48.14765, -146.35038674],
+        [16.53665592, 48.14765204, -146.34536617],
+        [16.53666, 48.14765607, -146.32334215],
+        [16.53666198, 48.14765802, -146.31156703],
+        [16.53666399, 48.14766, -146.30001342],
+        [16.53667, 48.14766592, -146.24125289],
+        [16.53667275, 48.14766863, -146.21284864],
+        [16.53667414, 48.14767, -146.20879279],
+        [16.53668213, 48.14767787, -146.1938368],
+        [16.5366843, 48.14768, -146.17711409],
+        [16.53669, 48.14768562, -146.16561983],
+        [16.53669445, 48.14769, -146.17],
+        [16.53670228, 48.14769772, -146.16228143],
+        [16.5367046, 48.1477, -146.16459732],
+        [16.53671, 48.14770532, -146.16467769],
+        [16.53671475, 48.14771, -146.15525168],
+        [16.53671739, 48.14771261, -146.14739384],
+        [16.53672, 48.14771517, -146.11895868],
+        [16.5367249, 48.14772, -146.09244966],
+        [16.53673251, 48.14772749, -146.1],
+        [16.53673505, 48.14773, -146.08989933],
+        [16.53673754, 48.14773246, -146.08712323],
+        [16.53674, 48.14773488, -146.07512397],
+        [16.53674258, 48.14773742, -146.07516236],
+        [16.53675, 48.14774473, -146.06128182],
+        [16.53675266, 48.14774734, -146.05073439],
+        [16.53675535, 48.14775, -146.05046477],
+        [16.53676, 48.14775458, -146.04725289],
+        [16.53676411, 48.14775863, -146.04619306],
+        [16.53677118, 48.14776559, -146.05070528],
+        [16.53677565, 48.14777, -146.05208893],
+        [16.53678, 48.14777428, -146.04444132],
+        [16.53678288, 48.14777712, -146.03850708],
+        [16.53679, 48.14778413, -146.05210744],
+        [16.53679596, 48.14779, -146.04859564],
+        [16.5368, 48.14779398, -146.05975537],
+        [16.53680303, 48.14779697, -146.0853955],
+        [16.53681, 48.14780383, -146.10630826],
+        [16.53681311, 48.14780689, -146.11345379],
+        [16.53681626, 48.14781, -146.09723826],
+        [16.53682318, 48.14781682, -146.10186761],
+        [16.53682641, 48.14782, -146.0758255],
+        [16.53682822, 48.14782178, -146.06373106],
+        [16.53683, 48.14782354, -146.06384298],
+        [16.53683829, 48.14783171, -146.0859259],
+        [16.53684, 48.14783339, -146.08606612],
+        [16.53684837, 48.14784163, -146.10181599],
+        [16.53685, 48.14784324, -146.11541653],
+        [16.53685844, 48.14785156, -146.1427194],
+        [16.53686, 48.14785309, -146.13554545],
+        [16.53686701, 48.14786, -146.02888926],
+        [16.53687, 48.14786294, -145.9918562],
+        [16.53687859, 48.14787141, -146.02322148],
+        [16.53688, 48.14787279, -146.01592727],
+        [16.53688363, 48.14787637, -146.02106911],
+        [16.53688732, 48.14788, -146.02409396],
+        [16.53688867, 48.14788133, -146.02680266],
+        [16.53689, 48.14788264, -146.0186281],
+        [16.53689874, 48.14789126, -145.95798834],
+        [16.5369, 48.1478925, -145.95126446],
+        [16.53690762, 48.1479, -145.93071309],
+        [16.53691386, 48.14790614, -145.92156536],
+        [16.53691777, 48.14791, -145.92165268],
+        [16.53692, 48.1479122, -145.92390083],
+        [16.53692792, 48.14792, -145.96751678],
+        [16.53692897, 48.14792103, -145.97731557],
+        [16.53693, 48.14792205, -145.97610579],
+        [16.536934, 48.147926, -145.97661948],
+        [16.53693807, 48.14793, -145.96826342],
+        [16.53693904, 48.14793096, -145.96712739],
+        [16.53694187, 48.14793375, -145.96906352],
+        [16.53695276, 48.14794447, -145.97881506],
+        [16.53695837, 48.14795, -146.02779362],
+        [16.53696, 48.1479516, -146.04801653],
+        [16.53696565, 48.14795717, -146.09565387],
+        [16.53696852, 48.14796, -146.13901007],
+        [16.53697731, 48.14796865, -146.18606133],
+        [16.53697867, 48.14797, -146.19503523],
+        [16.53697912, 48.14797044, -146.19941736],
+        [16.53697956, 48.14797087, -146.20073754],
+        [16.53698922, 48.14798039, -146.22094825],
+        [16.53699, 48.14798116, -146.22119008],
+        [16.53699898, 48.14799, -146.22397651],
+        [16.53699949, 48.14799051, -146.22464446],
+        [16.537, 48.14799101, -146.22469752],
+        [16.53700957, 48.14800043, -146.24578768],
+        [16.53701, 48.14800086, -146.24966446],
+        [16.53701964, 48.14801036, -146.29935803],
+        [16.53702943, 48.14802, -146.33911577],
+        [16.53703, 48.14802056, -146.3365719],
+        [16.53703958, 48.14803, -146.36426678],
+        [16.53703979, 48.14803021, -146.36691757],
+        [16.53704, 48.14803041, -146.36915702],
+        [16.53704483, 48.14803517, -146.4162831],
+        [16.53704973, 48.14804, -146.42519463],
+        [16.53704987, 48.14804013, -146.42607993],
+        [16.53705, 48.14804026, -146.42687273],
+        [16.53705026, 48.14804052, -146.42800651],
+        [16.53706498, 48.14805502, -146.50947294],
+        [16.53707, 48.14805997, -146.41383884],
+        [16.53707505, 48.14806495, -146.38782265],
+        [16.53708018, 48.14807, -146.2549849],
+        [16.53709, 48.14807967, -146.17102479],
+        [16.53709017, 48.14807983, -146.16886761],
+        [16.53709034, 48.14808, -146.16765101],
+        [16.5370952, 48.1480848, -146.06978518],
+        [16.5371, 48.14808952, -146.07810248],
+        [16.53710024, 48.14808976, -146.07856953],
+        [16.53710049, 48.14809, -146.07724329],
+        [16.53710099, 48.14809049, -146.077],
+        [16.53711064, 48.1481, -146.06670134],
+        [16.53711535, 48.14810465, -146.07514155],
+        [16.53712, 48.14810922, -146.00874876],
+        [16.53712039, 48.14810961, -146.0027652],
+        [16.53712079, 48.14811, -146.00158054],
+        [16.53712389, 48.14811306, -146.00180301],
+        [16.53712543, 48.14811457, -145.97387677],
+        [16.53712594, 48.14811507, -145.97576373],
+        [16.53713047, 48.14811953, -145.88186012],
+        [16.53713187, 48.14812092, -145.85101091],
+        [16.53713287, 48.1481219, -145.84510153],
+        [16.53713971, 48.14812864, -145.67681244],
+        [16.53714031, 48.14812923, -145.65155866],
+        [16.53714164, 48.14813054, -145.67523479],
+        [16.53714216, 48.14813106, -145.68460115]
+      ],
+      [
+        [16.53593403, 48.14694089, -146.52419461],
+        [16.53593398, 48.14694085, -146.52394016]
+      ],
+      [
+        [16.53593432, 48.14694119, -146.52544823],
+        [16.53593403, 48.14694089, -146.52419614]
+      ]
+    ]
+  },
+  properties: {}
+};
+
+test("prepare diagram", () => {
+  const result = prepareProfile(demodata);
+  const alts = result.points.reduce((o, n) => {
+    let y = n.map(e => {
+      return e.y;
+    });
+    o = o.concat(y);
+    return o;
+  }, []);
+  const minAlt = Math.min(...alts);
+  const maxAlt = Math.max(...alts);
+  expect(result.points.length).toBe(3);
+  expect(result.totalLength).toBe(160.06814078495722);
+  expect(result.minAlt).toBe(minAlt);
+  expect(result.maxAlt).toBe(maxAlt);
+});