changeset 862:0a6cb09ca28c

client: fix bottleneck WMS loading
author Bernhard Reiter <bernhard@intevation.de>
date Fri, 28 Sep 2018 18:09:59 +0200
parents aa4aaf04d41e
children d1863e91b039
files client/src/map/store.js
diffstat 1 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/store.js	Fri Sep 28 17:21:40 2018 +0200
+++ b/client/src/map/store.js	Fri Sep 28 18:09:59 2018 +0200
@@ -44,20 +44,16 @@
               TILED: true
             },
             tileLoadFunction: function(tile, src) {
+              // console.log("calling for", tile, src);
               HTTP.get(src, {
                 headers: {
                   "X-Gemma-Auth": localStorage.getItem("token")
-                }
+                },
+                responseType: "blob"
               }).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;
+                tile.getImage().src = URL.createObjectURL(response.data);
               });
-            }
+            }  // TODO  tile.setState(TileState.ERROR);
           })
         }),
         isVisible: true