Mercurial > gemma
changeset 852:a3b2626cef49
Client: Load WMS layer with sounding result contour lines.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 28 Sep 2018 13:45:04 +0200 |
parents | c0bb673d360e |
children | fb39ec3b95a8 83c271cb2344 |
files | client/src/map/store.js |
diffstat | 1 files changed, 23 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/map/store.js Fri Sep 28 13:07:38 2018 +0200 +++ b/client/src/map/store.js Fri Sep 28 13:45:04 2018 +0200 @@ -6,6 +6,7 @@ import { Stroke, Style, Fill, Text, Circle as CircleStyle } from "ol/style.js"; import VectorSource from "ol/source/Vector.js"; import { bbox as bboxStrategy } from "ol/loadingstrategy"; +import { HTTP } from "../application/lib/http"; const MapStore = { namespaced: true, @@ -36,9 +37,28 @@ source: new TileWMS({ preload: 0, projection: "EPSG:3857", - // TODOISO replace with our own request function - url: "http://wamos-dev1.hq:8550/geoserver/gemma/wms", - params: { LAYERS: "sounding_results_contour_lines_geoserver", VERSION: "1.1.1", TILED: true } + url: window.location.origin + "/api/internal/wms", + params: { + LAYERS: "sounding_results_contour_lines_geoserver", + VERSION: "1.1.1", + TILED: true + }, + tileLoadFunction: function(tile, src) { + HTTP.get(src, { + headers: { + "X-Gemma-Auth": localStorage.getItem("token") + } + }) + .then(response => { + var arrayBufferView = new Uint8Array(response); + var blob = new Blob([arrayBufferView], { + type: "image/png" + }); + var urlCreator = window.URL || window.webkitURL; + var imageUrl = urlCreator.createObjectURL(blob); + tile.getImage().src = imageUrl; + }); + } }) }), isVisible: true