comparison client/src/components/map/layers.js @ 3047:e0b77d7463e7

Changed Waterway axis and area layer to WMS.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 15 Apr 2019 15:15:16 +0200
parents f99f0cbb843f
children 0cb180676722
comparison
equal deleted inserted replaced
3046:c764c73f44b4 3047:e0b77d7463e7
82 url: "https://service.d4d-portal.info/wms/", 82 url: "https://service.d4d-portal.info/wms/",
83 crossOrigin: "anonymous", 83 crossOrigin: "anonymous",
84 params: { LAYERS: "d4d", VERSION: "1.1.1", TILED: true } 84 params: { LAYERS: "d4d", VERSION: "1.1.1", TILED: true }
85 }) 85 })
86 }), 86 }),
87 (function() { 87 new ImageLayer({
88 const source = new VectorSource({ strategy: bboxStrategy }); 88 id: "WATERWAYAREA",
89 source.setLoader( 89 label: "Waterway Area",
90 buildVectorLoader( 90 maxResolution: 100,
91 { 91 minResolution: 0,
92 featureTypes: ["waterway_area"], 92 source: new ImageSource({
93 geometryName: "area" 93 url: window.location.origin + "/api/internal/wms",
94 }, 94 params: { LAYERS: "waterway_area", VERSION: "1.1.1", TILED: true },
95 source 95 imageLoadFunction: function(tile, src) {
96 ) 96 HTTP.get(src, {
97 ); 97 headers: {
98 return new VectorLayer({ 98 "X-Gemma-Auth": localStorage.getItem("token")
99 id: "WATERWAYAREA", 99 },
100 label: "Waterway Area", 100 responseType: "blob"
101 visible: true, 101 }).then(response => {
102 style: new Style({ 102 tile.getImage().src = URL.createObjectURL(response.data);
103 stroke: new Stroke({ 103 });
104 color: "rgba(0, 102, 0, 1)", 104 } // TODO tile.setState(TileState.ERROR);
105 width: 2 105 })
106 }) 106 }),
107 }),
108 source
109 });
110 })(),
111 (function() { 107 (function() {
112 const source = new VectorSource({ strategy: bboxStrategy }); 108 const source = new VectorSource({ strategy: bboxStrategy });
113 source.setLoader( 109 source.setLoader(
114 buildVectorLoader( 110 buildVectorLoader(
115 { 111 {
197 maxResolution: 80, 193 maxResolution: 80,
198 minResolution: 0, 194 minResolution: 0,
199 source 195 source
200 }); 196 });
201 })(), 197 })(),
202 (function() { 198 new ImageLayer({
203 const source = new VectorSource({ strategy: bboxStrategy }); 199 id: "WATERWAYAXIS",
204 source.setLoader( 200 label: "Waterway Axis",
205 buildVectorLoader( 201 source: new ImageSource({
206 { 202 url: window.location.origin + "/api/internal/wms",
207 featureTypes: ["waterway_axis"], 203 params: { LAYERS: "waterway_axis", VERSION: "1.1.1", TILED: true },
208 geometryName: "wtwaxs" 204 imageLoadFunction: function(tile, src) {
209 }, 205 HTTP.get(src, {
210 source 206 headers: {
211 ) 207 "X-Gemma-Auth": localStorage.getItem("token")
212 ); 208 },
213 return new VectorLayer({ 209 responseType: "blob"
214 id: "WATERWAYAXIS", 210 }).then(response => {
215 label: "Waterway Axis", 211 tile.getImage().src = URL.createObjectURL(response.data);
216 visible: true, 212 });
217 style: new Style({ 213 } // TODO tile.setState(TileState.ERROR);
218 stroke: new Stroke({ 214 })
219 color: "rgba(0, 0, 255, .5)", 215 }),
220 lineDash: [5, 5],
221 width: 2
222 })
223 }),
224 // TODO: Set layer in layertree active/inactive depending on
225 // resolution.
226 maxResolution: 5,
227 minResolution: 0,
228 source
229 });
230 })(),
231 (function() { 216 (function() {
232 const source = new VectorSource({ strategy: bboxStrategy }); 217 const source = new VectorSource({ strategy: bboxStrategy });
233 source.setLoader( 218 source.setLoader(
234 buildVectorLoader( 219 buildVectorLoader(
235 { 220 {