Mercurial > gemma
comparison 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 |
comparison
equal
deleted
inserted
replaced
2124:af136b1a854e | 2125:ea5a0e771b71 |
---|---|
34 import { HTTP } from "@/lib/http"; | 34 import { HTTP } from "@/lib/http"; |
35 import { mapGetters, mapState } from "vuex"; | 35 import { mapGetters, mapState } from "vuex"; |
36 import "ol/ol.css"; | 36 import "ol/ol.css"; |
37 import { Map, View } from "ol"; | 37 import { Map, View } from "ol"; |
38 import { WFS, GeoJSON } from "ol/format.js"; | 38 import { WFS, GeoJSON } from "ol/format.js"; |
39 import { equalTo } from "ol/format/filter.js"; | |
39 import { Stroke, Style, Fill } from "ol/style.js"; | 40 import { Stroke, Style, Fill } from "ol/style.js"; |
40 | 41 |
41 /* for the sake of debugging */ | 42 /* for the sake of debugging */ |
42 /* eslint-disable no-console */ | 43 /* eslint-disable no-console */ |
43 export default { | 44 export default { |
177 }); | 178 }); |
178 this.$store.dispatch("map/openLayersMap", map); | 179 this.$store.dispatch("map/openLayersMap", map); |
179 | 180 |
180 // TODO make display of layers more dynamic, e.g. from a list | 181 // TODO make display of layers more dynamic, e.g. from a list |
181 | 182 |
182 // loading the full WFS layer, by not setting the loader function | 183 // load different fairway dimension layers (level of service) |
183 // and without bboxStrategy | 184 ["1", "2", "3"].forEach(los => { |
184 var featureRequest = new WFS().writeGetFeature({ | 185 // loading the full WFS layer, by not setting the loader function |
185 srsName: "EPSG:3857", | 186 // and without bboxStrategy |
186 featureNS: "gemma", | 187 var featureRequest = new WFS().writeGetFeature({ |
187 featurePrefix: "gemma", | 188 srsName: "EPSG:3857", |
188 featureTypes: ["fairway_dimensions"], | 189 featureNS: "gemma", |
189 outputFormat: "application/json" | 190 featurePrefix: "gemma", |
190 }); | 191 featureTypes: ["fairway_dimensions"], |
191 | 192 outputFormat: "application/json", |
192 // NOTE: loading the full fairway_dimensions makes sure | 193 filter: equalTo("level_of_service", los) |
193 // that all are available for the intersection with the profile | 194 }); |
194 HTTP.post( | 195 |
195 "/internal/wfs", | 196 // NOTE: loading the full fairway_dimensions makes sure |
196 new XMLSerializer().serializeToString(featureRequest), | 197 // that all are available for the intersection with the profile |
197 { | 198 HTTP.post( |
198 headers: { | 199 "/internal/wfs", |
199 "X-Gemma-Auth": localStorage.getItem("token"), | 200 new XMLSerializer().serializeToString(featureRequest), |
200 "Content-type": "text/xml; charset=UTF-8" | 201 { |
202 headers: { | |
203 "X-Gemma-Auth": localStorage.getItem("token"), | |
204 "Content-type": "text/xml; charset=UTF-8" | |
205 } | |
201 } | 206 } |
202 } | 207 ).then(response => { |
203 ).then(response => { | 208 this.getVSourceByName("Fairway Dimensions LOS " + los).addFeatures( |
204 this.getVSourceByName("Fairway Dimensions").addFeatures( | 209 new GeoJSON().readFeatures(JSON.stringify(response.data)) |
205 new GeoJSON().readFeatures(JSON.stringify(response.data)) | 210 ); |
206 ); | 211 // would scale to the extend of all resulting features |
207 // would scale to the extend of all resulting features | 212 // this.openLayersMap.getView().fit(vectorSrc.getExtent()); |
208 // this.openLayersMap.getView().fit(vectorSrc.getExtent()); | 213 }); |
209 }); | 214 }); |
210 | 215 |
211 // load following layers with bboxStrategy (using our request builder) | 216 // load following layers with bboxStrategy (using our request builder) |
212 var layer = null; | 217 var layer = null; |
213 | 218 |