changeset 4926:271616eff8e3 fairway-marks-import

Merge branch default into fairway-marks-import
author Tom Gottfried <tom@intevation.de>
date Fri, 14 Feb 2020 14:33:42 +0100
parents b86ce7fc4da3 (current diff) 0b10d3c68da0 (diff)
children 6081cbe71b81
files
diffstat 5 files changed, 32 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/Fairwayprofile.vue	Fri Feb 14 13:01:45 2020 +0100
+++ b/client/src/components/fairway/Fairwayprofile.vue	Fri Feb 14 14:33:42 2020 +0100
@@ -197,6 +197,7 @@
       "startPoint",
       "endPoint",
       "fairwayData",
+      "minAlt",
       "maxAlt",
       "selectedWaterLevel",
       "depth",
@@ -652,21 +653,28 @@
         .scaleLinear()
         .domain([0, this.totalLength])
         .rangeRound([0, width]);
-
+      // Upper limit is relevant for the extension of the y-Axis
+      // If there is no measure above the waterlevel we choose a cosmetic value of this.maxAlt *0.1
+      // to get a bit of space above the waterlevel.
+      // Otherwise we take the maximum measured value
+      const upperLimit =
+        this.minAlt > 0 ? this.maxAlt * 0.1 : Math.abs(this.minAlt);
+      // In order to draw positive values downwards, we switch both values in the
+      // domain definition [min, max] => [max, min] has the desired effect.
       let yScaleRight = d3
         .scaleLinear()
         .domain([
           this.maxAlt * 1.1 + (this.waterlevel - this.refWaterlevel) / 100,
-          -(this.maxAlt * 0.1)
+          -upperLimit
         ])
         .rangeRound([height, 0]);
-
+      // This definition is accordingly but uses values * 100 for the tickformatter
       let yScaleLeft = d3
         .scaleLinear()
         .domain([
           this.waterlevel -
             (this.maxAlt * 110 + (this.waterlevel - this.refWaterlevel)),
-          this.waterlevel + this.maxAlt * 10
+          this.waterlevel + upperLimit * 100
         ])
         .rangeRound([height, 0]);
 
--- a/client/src/lib/geo.js	Fri Feb 14 13:01:45 2020 +0100
+++ b/client/src/lib/geo.js	Fri Feb 14 14:33:42 2020 +0100
@@ -20,19 +20,20 @@
  *
  */
 
-import { GeoJSON } from "ol/format";
-import Feature from "ol/Feature";
-import distance from "@turf/distance";
 import {
   lineString as turfLineString,
-  polygon as turfPolygon,
-  point as turfPoint
+  point as turfPoint,
+  polygon as turfPolygon
 } from "@turf/helpers";
-import lineSplit from "@turf/line-split";
-import lineSlice from "@turf/line-slice";
-import lineIntersect from "@turf/line-intersect";
+
+import Feature from "ol/Feature";
+import { GeoJSON } from "ol/format";
 // import booleanWithin from "@turf/boolean-within";
 import booleanContains from "@turf/boolean-contains";
+import distance from "@turf/distance";
+import lineIntersect from "@turf/line-intersect";
+import lineSlice from "@turf/line-slice";
+import lineSplit from "@turf/line-split";
 
 const EARTHRADIUS = 6378137.0;
 
@@ -113,7 +114,7 @@
     for (let coordinateTriplet of segment) {
       currentPoint = Point(coordinateTriplet);
       lengthPolyLine += distanceBetween(referencePoint, currentPoint);
-      let y = Math.abs(currentPoint.alt);
+      let y = currentPoint.alt;
       points.push({
         x: lengthPolyLine,
         y: y
--- a/docker/Dockerfile.geoserv	Fri Feb 14 13:01:45 2020 +0100
+++ b/docker/Dockerfile.geoserv	Fri Feb 14 14:33:42 2020 +0100
@@ -15,7 +15,7 @@
 
 ENV GS_URL https://downloads.sourceforge.net/project/geoserver/GeoServer
 
-ENV GS_VERSION 2.16.0
+ENV GS_VERSION 2.16.2
 ENV GS_DATADIR /opt/geoserver/data
 
 ENV CATALINA_OPTS="-DGEOSERVER_DATA_DIR=$GS_DATADIR"
--- a/pkg/controllers/surveys.go	Fri Feb 14 13:01:45 2020 +0100
+++ b/pkg/controllers/surveys.go	Fri Feb 14 14:33:42 2020 +0100
@@ -32,11 +32,11 @@
   s.bottleneck_id,
   s.date_info::text,
   s.depth_reference,
-  g.objname AS gauge_objname,
+  COALESCE(g.objname, 'ERROR: MISSING GAUGE') AS gauge_objname,
   r.value AS waterlevel_value
 FROM waterway.bottlenecks AS b
   JOIN waterway.sounding_results AS s ON b.bottleneck_id = s.bottleneck_id
-  JOIN waterway.gauges AS g
+  LEFT JOIN waterway.gauges AS g
     ON b.gauge_location = g.location AND s.date_info::timestamptz <@ g.validity
   LEFT JOIN waterway.gauges_reference_water_levels AS r
     ON s.depth_reference = r.depth_reference
--- a/pkg/mesh/cache.go	Fri Feb 14 13:01:45 2020 +0100
+++ b/pkg/mesh/cache.go	Fri Feb 14 14:33:42 2020 +0100
@@ -68,13 +68,7 @@
 `
 )
 
-var cache = Cache{
-	entries: map[cacheKey]*cacheEntry{},
-}
-
-func init() {
-	go cache.background()
-}
+var cache Cache
 
 func (c *Cache) background() {
 	for {
@@ -129,6 +123,12 @@
 	c.Lock()
 	defer c.Unlock()
 
+	// Start background cleanup lazily.
+	if c.entries == nil {
+		c.entries = map[cacheKey]*cacheEntry{}
+		go c.background()
+	}
+
 	key := cacheKey{date, bottleneck}
 	entry := c.entries[key]