changeset 4376:8949b4d714ee

importoverview: improve identification of features to review
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 11 Sep 2019 16:15:32 +0200
parents 6ebd2d7756d5
children 4707fa47284a
files client/src/components/importoverview/FairwayDimensionDetail.vue
diffstat 1 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importoverview/FairwayDimensionDetail.vue	Wed Sep 11 16:02:41 2019 +0200
+++ b/client/src/components/importoverview/FairwayDimensionDetail.vue	Wed Sep 11 16:15:32 2019 +0200
@@ -32,6 +32,37 @@
 import VectorSource from "ol/source/Vector";
 import { buildVectorLoader } from "@/components/map/layers.js";
 import { bbox as bboxStrategy } from "ol/loadingstrategy";
+import { WFS } from "ol/format";
+import { HTTP } from "@/lib/http";
+
+const getFromWFS = (type, filter) => {
+  return new Promise((resolve, reject) => {
+    var featureCollectionRequest = new WFS().writeGetFeature({
+      srsName: "EPSG:4326",
+      featureNS: "gemma",
+      featurePrefix: "gemma",
+      featureTypes: [type],
+      outputFormat: "application/json",
+      filter: filter
+    });
+    HTTP.post(
+      "/internal/wfs",
+      new XMLSerializer().serializeToString(featureCollectionRequest),
+      {
+        headers: {
+          "X-Gemma-Auth": localStorage.getItem("token"),
+          "Content-type": "text/xml; charset=UTF-8"
+        }
+      }
+    )
+      .then(response => {
+        resolve(response);
+      })
+      .catch(error => {
+        reject(error);
+      });
+  });
+};
 
 export default {
   props: ["summary"],
@@ -63,6 +94,14 @@
       )
     );
     fairwaydimensionLayer.setSource(source);
+    getFromWFS("fairway_dimensions", ids[0]).then(response => {
+      const {
+        level_of_service,
+        source_organization
+      } = response.data.features[0].properties;
+      this.LOS = level_of_service;
+      this.organization = source_organization;
+    });
     // this.$store.dispatch("map/moveToBoundingBox", {
     //   boundingBox: ,
     //   zoom: 17,