Mercurial > gemma
annotate client/src/map/Maplayer.vue @ 668:3e2eeb215d0e
feat: searchbar collapsible
Searchbar is now styled according to other buttons.
Searchbar is collapsible.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 18 Sep 2018 18:23:15 +0200 |
parents | c6aacd396918 |
children | f595b3455d75 |
rev | line source |
---|---|
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
620
diff
changeset
|
2 <div id="map" :class="mapStyle"></div> |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 </template> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 <style lang="scss"> |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
6 .mapsplit { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
7 height: 50vh; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
9 |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
10 .mapfull { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
11 height: 100vh; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
13 </style> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
14 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
15 <script> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 import { HTTP } from "../application/lib/http"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 import "ol/ol.css"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 import { Map, View } from "ol"; |
663
db749c02127c
Client: slightly improve wfs loading for marks
Bernhard Reiter <bernhard@intevation.de>
parents:
659
diff
changeset
|
19 import { bbox as bboxFilter } from "ol/format/filter.js"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
20 import { WFS, GeoJSON } from "ol/format.js"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
21 import { mapGetters } from "vuex"; |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
22 import Draw from "ol/interaction/Draw.js"; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
23 import { Vector as VectorSource } from "ol/source.js"; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
24 import { Vector as VectorLayer } from "ol/layer.js"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
25 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 export default { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
27 name: "maplayer", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
28 props: ["drawMode", "lat", "long", "zoom", "split"], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
29 data() { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 return { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 projection: "EPSG:3857", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
32 openLayersMap: null, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
33 interaction: null, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
34 vectorLayer: null, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
35 vectorSource: null |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
36 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
37 }, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
38 computed: { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
39 ...mapGetters("mapstore", ["layers"]), |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
40 mapStyle() { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
41 return { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
42 mapfull: !this.split, |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
43 mapsplit: this.split |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
44 }; |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
45 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
46 layerData() { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
47 const l = this.layers.map(x => { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
48 return x.data; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
49 }); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
50 return [...l, this.vectorLayer]; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 }, |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
53 methods: { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
54 createVectorSource() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
55 this.vectorSource = new VectorSource({ wrapX: false }); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
56 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
57 createVectorLayer() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
58 this.vectorLayer = new VectorLayer({ |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
59 source: this.vectorSource |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
60 }); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
61 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
62 removeCurrentInteraction() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
63 this.openLayersMap.removeInteraction(this.interaction); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
64 this.interaction = null; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
65 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
66 createInteraction() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
67 return new Draw({ |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
68 source: this.vectorSource, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
69 type: this.drawMode |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
70 }); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
71 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
72 activateInteraction() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
73 const interaction = this.createInteraction(this.drawMode); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
74 this.interaction = interaction; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
75 this.openLayersMap.addInteraction(interaction); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
76 } |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
77 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
78 watch: { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
79 drawMode() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
80 if (this.interaction) { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
81 this.removeCurrentInteraction(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
82 } else { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
83 this.activateInteraction(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
84 } |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
85 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
86 split() { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
87 const map = this.openLayersMap; |
594
6987b5c926b8
fix: leveraging vue.nexttick instead of timeout
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
88 this.$nextTick(() => { |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
89 map.updateSize(); |
594
6987b5c926b8
fix: leveraging vue.nexttick instead of timeout
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
90 }); |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
91 } |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
92 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 mounted() { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
94 this.createVectorSource(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
95 this.createVectorLayer(); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
96 this.openLayersMap = new Map({ |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
97 layers: this.layerData, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 target: "map", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
99 controls: [], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
100 view: new View({ |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 center: [this.long, this.lat], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
102 zoom: this.zoom, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
103 projection: this.projection |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
104 }) |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
105 }); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
107 var featureRequest2 = new WFS().writeGetFeature({ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 // srsName: "urn:ogc:def:crs:EPSG::4326", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
109 srsName: "EPSG:3857", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
110 featureNS: "gemma", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
111 featurePrefix: "gemma", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 featureTypes: ["fairway_dimensions"], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 outputFormat: "application/json" |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
114 }); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
115 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
116 HTTP.post( |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
117 "/internal/wfs", |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
118 new XMLSerializer().serializeToString(featureRequest2), |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
119 { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
120 headers: { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
121 "X-Gemma-Auth": localStorage.getItem("token"), |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
122 "Content-type": "text/xml; charset=UTF-8" |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
123 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
124 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
125 ).then(response => { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
126 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
127 var vectorSrc = this.layers[2].data.getSource(); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
128 vectorSrc.addFeatures(features); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
129 // would scale to the extend of all resulting features |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
130 // this.openLayersMap.getView().fit(vectorSrc.getExtent()); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
131 }); |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
132 |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
133 // FIXME hardwired for now |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
134 var featureRequest3 = new WFS().writeGetFeature({ |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
135 featurePrefix: "ws-wamos", |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
136 featureTypes: ["ienc_wtware"], |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
137 outputFormat: "application/json" |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
138 }); |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
139 |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
140 HTTP.post( |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
141 "/external/d4d", |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
142 new XMLSerializer().serializeToString(featureRequest3), |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
143 { |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
144 headers: { |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
145 "X-Gemma-Auth": localStorage.getItem("token"), |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
146 "Content-type": "text/xml; charset=UTF-8" |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
147 } |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
148 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
149 ).then(response => { |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
150 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
151 var vectorSrc = this.layers[3].data.getSource(); |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
152 vectorSrc.addFeatures(features); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
153 }); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
154 |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
155 // FIXME hardwired for now |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
156 var featureRequest4 = new WFS().writeGetFeature({ |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
157 featurePrefix: "ws-wamos", |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
158 featureTypes: ["ienc_wtwaxs"], |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
159 outputFormat: "application/json" |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
160 }); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
161 |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
162 HTTP.post( |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
163 "/external/d4d", |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
164 new XMLSerializer().serializeToString(featureRequest4), |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
165 { |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
166 headers: { |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
167 "X-Gemma-Auth": localStorage.getItem("token"), |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
168 "Content-type": "text/xml; charset=UTF-8" |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
169 } |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
170 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
171 ).then(response => { |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
172 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
173 var vectorSrc = this.layers[4].data.getSource(); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
174 vectorSrc.addFeatures(features); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
175 }); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
176 |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
177 // FIXME this is hardwired for now to try for an external point layer |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
178 var featureRequest5 = new WFS().writeGetFeature({ |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
179 featurePrefix: "ws-wamos", |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
180 featureTypes: ["ienc_dismar"], |
663
db749c02127c
Client: slightly improve wfs loading for marks
Bernhard Reiter <bernhard@intevation.de>
parents:
659
diff
changeset
|
181 outputFormat: "application/json", |
db749c02127c
Client: slightly improve wfs loading for marks
Bernhard Reiter <bernhard@intevation.de>
parents:
659
diff
changeset
|
182 /* restrict loading approximately to extend of danube in Austria */ |
db749c02127c
Client: slightly improve wfs loading for marks
Bernhard Reiter <bernhard@intevation.de>
parents:
659
diff
changeset
|
183 filter: bboxFilter("geom", [13.3, 48.0, 17.1, 48.6], "EPSG:4326") |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
184 }); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
185 |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
186 HTTP.post( |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
187 "/external/d4d", |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
188 new XMLSerializer().serializeToString(featureRequest5), |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
189 { |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
190 headers: { |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
191 "X-Gemma-Auth": localStorage.getItem("token"), |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
192 "Content-type": "text/xml; charset=UTF-8" |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
193 } |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
194 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
195 ).then(response => { |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
196 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
197 var vectorSrc = this.layers[5].data.getSource(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
198 this.layers[5].data.setVisible(this.layers[5].isVisible); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
199 vectorSrc.addFeatures(features); |
663
db749c02127c
Client: slightly improve wfs loading for marks
Bernhard Reiter <bernhard@intevation.de>
parents:
659
diff
changeset
|
200 console.log("loaded ", features, "for", vectorSrc); |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
201 }); |
659
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
202 |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
203 // FIXME this is hardwired for now |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
204 var featureRequest6 = new WFS().writeGetFeature({ |
667
c6aacd396918
client: improve waterway axis mark display
Bernhard Reiter <bernhard@intevation.de>
parents:
663
diff
changeset
|
205 srsName: "EPSG:3857", |
659
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
206 featureNS: "gemma", |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
207 featurePrefix: "gemma", |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
208 featureTypes: ["distance_marks"], |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
209 outputFormat: "application/json" |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
210 }); |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
211 |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
212 HTTP.post( |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
213 "/internal/wfs", |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
214 new XMLSerializer().serializeToString(featureRequest6), |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
215 { |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
216 headers: { |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
217 "X-Gemma-Auth": localStorage.getItem("token"), |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
218 "Content-type": "text/xml; charset=UTF-8" |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
219 } |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
220 } |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
221 ).then(response => { |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
222 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
223 var vectorSrc = this.layers[6].data.getSource(); |
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
224 vectorSrc.addFeatures(features); |
663
db749c02127c
Client: slightly improve wfs loading for marks
Bernhard Reiter <bernhard@intevation.de>
parents:
659
diff
changeset
|
225 console.log("loaded ", features, "for", vectorSrc); |
659
ef658c66cfca
schema: disable sfcgal
Bernhard Reiter <bernhard@intevation.de>
parents:
649
diff
changeset
|
226 }); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
227 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
228 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
229 </script> |