1

I am working with Openlayers 2. The problem that I am facing right now is that I have multiple editable layers in my application I want to add, delete, modify features as well as Displaying Feature information regarding features. So that I uses one SelectFeature Control for displaying info and one for deleting feature. when I select control from one of them it results conflicting with each other.

How can i remove this problem?

2

Try defining seperate events like this:

        vectors1.addFeatures(createFeatures());
        vectors2.addFeatures(createFeatures());

        vectors1.events.on({
            "featureselected": function(e) {
                showStatus("selected feature "+e.feature.id+" on Vector Layer 1");
            },
            "featureunselected": function(e) {
                showStatus("unselected feature "+e.feature.id+" on Vector Layer 1");
            }
        });
        vectors2.events.on({
            "featureselected": function(e) {
                showStatus("selected feature "+e.feature.id+" on Vector Layer 2");
            },
            "featureunselected": function(e) {
                showStatus("unselected feature "+e.feature.id+" on Vector Layer 2");
            }
        });

There is a working example in offical OpenLayers example site http://dev.openlayers.org/examples/select-feature-multilayer.html

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.