3

I have a GIS SDK with WMS layers and Vector layers (with information from Geoserver).

I have methods for setting a style map, but I have a performance problem.

When I set same style for 30 layers, for example, the UI gets very slow because the 30 layers have to refresh.

Is it possible to reduce the refresh time for the layers?

I have been thinking about some this, but I need some advice:

a) Is it possible to refresh vector layers without downloading the whole WFS data again? I just want to set a style with some rules.

b) Is it possible to reduce the refreshing time of WMS layers, maybe juggling with the number/size of the tiles (I am using single tile now)?

c) I tried creating a layer group in Geoserver, but I don't know how I can apply a style to each of its layers. I don't even know if it is possible to manipulate the layers individually when they are in a layer group. Is it possible?

When I change zooms or when I pan the map, it is very slow too. I think it is related to this question, so I leave it as a P.S.

2 Answers 2

5

a. For WFS, I already done an answer somewhere else. If OpenLayers 2, use strategy please.

b. For WMS slow, it's not about GeoServer "slowness" than the fact you use so much layers and it acts on network >> See this twitter reaction to make some calculations.

#webgis please stop publishing maps with many active tiled layers: 20 layers X 20 tiles per screen X 30ko per tile = 12 Mo for each zoom !

— Michaël Douchin (@kimaidou) 24 Octobre 2014

WMS single tiles or multiple tiles is not really the issue: it will overload your network. With single tile, maybe less tiles to download but GeoServer will take time to render each layers. For lowering charge, you can try to use GeoWebCache (a tile cache server to speedup your WMS calls)

c. For layer groups in GeoServer, just apply the style you want on each layer and then make the group. Edit: you seem to want to apply styles using client side (at run time). In a layer group or not, it's not the best idea: you can't cache images and so, it will overload again your application.

IMO, your solution is not technical.

The best solution: make choice on your application and do not display all layers. This opinion clearly comes from this good series about Why Map Portals Don’t Work. You have to think about the requirements: it's not possible for end users to correctly read 30 layers of infos.

3
  • EDITED COMMENT: Thank you for answering. --- a) I looked at your other answer. I am already using readFormat GeoJSON, and strategy BBOX. The only thing I could try is use WMS for low zoom levels and WFS (Vector) for high zoom levels. --- b) Do you single tile is better or multiple tiles? --- c) I know, but I want to set the style on run-time. Is it posible to manipulate the layers in the group after the group is creted and called? --- Thanks
    – joaorodr84
    Commented Nov 6, 2014 at 0:28
  • Thanks for your edit. I will read the article you gave. Thanks a lot. :)
    – joaorodr84
    Commented Nov 6, 2014 at 0:29
  • Although quite old, the series was very interesting!
    – umbe1987
    Commented Jul 9, 2020 at 7:46
2

Vector layers have a 'redraw' method, which can be executed after changing style. After that, only re-rendering will occur and layer data remains unchanged. For example:

layer.styleMap.styles.default.defaultStyle.strokeColor = '#AAAAAA';
layer.styleMap.styles.default.defaultStyle.fillColor = '#ABCDEF';
layer.redraw();
1
  • 1
    Thanks @MichalMackiewicz. This tip does speed up a bit. :)
    – joaorodr84
    Commented Nov 5, 2014 at 15:12

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