Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer
    
Can you point me towards an example where such strategy is used ? couldn't find it in openlayers examples list. –  BiAiB Dec 21 '12 at 13:14
    
There is a basic example with rules at dev.openlayers.org/releases/OpenLayers-2.12/examples/…. And a filter dev.openlayers.org/releases/OpenLayers-2.12/examples/… about how to update features. –  cavila Dec 21 '12 at 13:21
    
thanks! I used a comparison filter which bounds are modified upon zoom change –  BiAiB Dec 21 '12 at 14:04

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.

share|improve this answer
    
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 Dec 21 '12 at 13:18
    
In that case, go for cavila's suggestion. I wasn't aware of rules and filtering myself :) –  user1702401 Dec 21 '12 at 13:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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