diff client/src/components/Maplayer.vue @ 2125:ea5a0e771b71

Distinct fairway layers per LOS There are now distinct layers for LOS1-3, which can be enabled/disabled in the legend. LOS2 has no data yet but works. Cross profiles show only LOS3 still. issue 261
author Markus Kottlaender <markus@intevation.de>
date Wed, 06 Feb 2019 11:47:02 +0100
parents f9f1babe52ae
children 22bbd0d0500e
line wrap: on
line diff
--- a/client/src/components/Maplayer.vue	Tue Feb 05 14:46:26 2019 +0100
+++ b/client/src/components/Maplayer.vue	Wed Feb 06 11:47:02 2019 +0100
@@ -36,6 +36,7 @@
 import "ol/ol.css";
 import { Map, View } from "ol";
 import { WFS, GeoJSON } from "ol/format.js";
+import { equalTo } from "ol/format/filter.js";
 import { Stroke, Style, Fill } from "ol/style.js";
 
 /* for the sake of debugging */
@@ -179,33 +180,37 @@
 
     // TODO make display of layers more dynamic, e.g. from a list
 
-    // loading the full WFS layer, by not setting the loader function
-    // and without bboxStrategy
-    var featureRequest = new WFS().writeGetFeature({
-      srsName: "EPSG:3857",
-      featureNS: "gemma",
-      featurePrefix: "gemma",
-      featureTypes: ["fairway_dimensions"],
-      outputFormat: "application/json"
-    });
+    // load different fairway dimension layers (level of service)
+    ["1", "2", "3"].forEach(los => {
+      // loading the full WFS layer, by not setting the loader function
+      // and without bboxStrategy
+      var featureRequest = new WFS().writeGetFeature({
+        srsName: "EPSG:3857",
+        featureNS: "gemma",
+        featurePrefix: "gemma",
+        featureTypes: ["fairway_dimensions"],
+        outputFormat: "application/json",
+        filter: equalTo("level_of_service", los)
+      });
 
-    // NOTE: loading the full fairway_dimensions makes sure
-    //       that all are available for the intersection with the profile
-    HTTP.post(
-      "/internal/wfs",
-      new XMLSerializer().serializeToString(featureRequest),
-      {
-        headers: {
-          "X-Gemma-Auth": localStorage.getItem("token"),
-          "Content-type": "text/xml; charset=UTF-8"
+      // NOTE: loading the full fairway_dimensions makes sure
+      //       that all are available for the intersection with the profile
+      HTTP.post(
+        "/internal/wfs",
+        new XMLSerializer().serializeToString(featureRequest),
+        {
+          headers: {
+            "X-Gemma-Auth": localStorage.getItem("token"),
+            "Content-type": "text/xml; charset=UTF-8"
+          }
         }
-      }
-    ).then(response => {
-      this.getVSourceByName("Fairway Dimensions").addFeatures(
-        new GeoJSON().readFeatures(JSON.stringify(response.data))
-      );
-      // would scale to the extend of all resulting features
-      // this.openLayersMap.getView().fit(vectorSrc.getExtent());
+      ).then(response => {
+        this.getVSourceByName("Fairway Dimensions LOS " + los).addFeatures(
+          new GeoJSON().readFeatures(JSON.stringify(response.data))
+        );
+        // would scale to the extend of all resulting features
+        // this.openLayersMap.getView().fit(vectorSrc.getExtent());
+      });
     });
 
     // load following layers with bboxStrategy (using our request builder)