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 a problem ( How to stop features to redraw unwillingly in OpenLayers ) that might be solved by aborting the beforefeatureremoved or beforefeaturesremoved event.

What I would like to to is to stop the layer from refreshing (removing and the adding again) features from a vector layer. If I for example make a javscript error in those methods the features isn't removed or refreshed. But causing a javascripts error causes other issues so I hope that there is a controlled way of doing this in Openlayers

I have tried the

layer.events.on({
   'beforefeatureremoved':function(evt){
       OpenLayers.Event.stop(evt);
    }
});

But it doesnt seem to do anything, Im I

Br Mike

share|improve this question
    
Have you tried to return false? –  Tommaso Feb 6 '13 at 16:11
    
Yes, and sadly that don't help either. –  Mike001 Feb 6 '13 at 16:24
add comment

1 Answer 1

Unfortunately the beforefeatureremoved and beforefeaturesremoved events will not prevent features from being removed when returning false from a listener - although the name would suggest such behavior.

share|improve this answer
    
Hi ahocevar Since you help me solve the main issue it dont need to abort the event any longer. But perhaps that will be needed in a later scenario. Do you have any idea on how to do it? As you write, returning false won't help. –  Mike001 Feb 7 '13 at 12:39
    
Better add your features to the layer and use a filter to not display them. But it depends on your use case whether this is feasible or not. –  ahocevar Feb 11 '13 at 16:51
    
Sadly thats not possible in this case. –  Mike001 Feb 19 '13 at 15:29
add comment

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.