3

I have 14000 point vector features in the map. Displaying them all is very slow (renders at like 1 fps in chrome).

How can I tell Openlayers to only display a subset of them, for example features with the highest priority attribute ?

I've seen that there is a max-scale and min-scale property that could be useful, but it's layer-wide and I think I need a per-feature option.

2 Answers 2

5

Yes, you can tell OpenLayers to reduce the number of rendered features by the use of a filter attached to your OpenLayers.Layer.Vector. Or by the use of OpenLayers.Rule class applied with your layer. Or by the use of OpenLayers.Filter class.

I use lots of vector layers and this solves the feature quantity on large scales.

Slow down may be caused also by parsing of features comming from server.

Prefer the canvas renderer. It is faster the SVG. I always use it and never got problems with it.

3
2

You could try canvas renderer, that improves rendering speed (but has several other disadvantages, like problems with selecting feature etc).

Also, usually so big datasets are displayed through WMS service (rendering is done on server side), are there any particular reasons, why you can't do that?

To reduce point count on map, you can use clustering strategy (http://dev.openlayers.org/releases/OpenLayers-2.12/examples/strategy-cluster.html). Since 14000 features is quite a lot, it may still be slow because of clustering computations.

2
  • Thanks for the tip about canvas renderer. All the filtering has to be done client side (the dataset is big to display, but not to load and store in memory). And a clustured approach would be useless for the data represented. Those features are Points of interest, and what I really need is just to not show the least important of them.
    – BiAiB
    Commented Dec 21, 2012 at 13:18
  • In that case, go for cavila's suggestion. I wasn't aware of rules and filtering myself :) Commented Dec 21, 2012 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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