0

I have a problem with slow rendering of WMS in my map server. It takes a minute when zooming and panning of map.

here is my code to add WMS layer to openlayers. Is there a way to speed up the process ?

   layerSources[i] = new ol.source.TileWMS({
                            url: mapAgenURL,
                            params: {
                                'LAYERS': wms,
                                TRANSPARENT: true,
                                'TILED': true,
                            },
                            serverType: 'mapserver',
                            projection: 'EPSG:32651',
                            crossOrigin: 'anonymous'
                        });

                        layers[i] = new ol.layer.Tile({
                            source: layerSources[i],
                            visible: init,
                            preload: Infinity
                        });
  • 2
    The problem is most probably in the MapServer which is slow with creating the tiles that OpenLayers if requesting. Why it is slow is a broad question, but usually if WMS is slow then the source data is not optimized for server use. Impossible to say more with the details you provide. – user30184 Nov 8 '17 at 8:32
  • hey sorry for the broad question. I'm using AIMS 2016 as my map server. there are below 20 layers and each layer contains big data. When i tried to test the map in AIMS it works pretty fast. but when i'm published the WMS and used it in openlayers the rendering is so slow and the it consumes almost all of the CPU. – gray Nov 8 '17 at 8:38
  • You mean that Openlayers is using all the CPU? But it should have almost nothing to do if it reads raster tiles from WMS, except to wait. – user30184 Nov 8 '17 at 9:42
1

If your problem is client side and CPU related, you should merge your MapServer calls in one instance :

   layerSources = new ol.source.TileWMS({
                        url: mapAgenURL,
                        params: {
                            'LAYERS': 'layer1,layer2,layer3', //put your layers here separated by a comma
                            TRANSPARENT: true,
                            'TILED': true,
                        },
                        serverType: 'mapserver',
                        projection: 'EPSG:32651',
                        crossOrigin: 'anonymous'
                    });

                    layers = new ol.layer.Tile({
                        source: layerSources,
                        visible: init,
                        preload: Infinity
                    });

Why ? If you call 20 tile layers, you call 20 tiles. You should let MapServer merges all layers and sends only one tile for 20 layers.

  • can't do it because i need to manipulate each layer on zooming and panning and i can't put different properties if to each layer if i add it like that. – gray Nov 9 '17 at 1:04
  • i tried it and it also takes long time to load initially but when you moving the map it's faster to load all visible layers compare to the one with different attributes and it's only 2 visible layers. – gray Nov 9 '17 at 1:22
  • The loading time is a server side issue. Maybe you should read this page : mapserver.org/faq.html#how-can-i-make-my-maps-run-faster. – EL Manu Nov 9 '17 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.