1

I have a OpenLayers.Layer.GML layer build with GeoJSON data given by MapFish. When I select his features control points are displayed and they let me edit the shape of the features. Well I don't want them! And I don't know how they appeared or why. There must be some setting in the control, in the layer or in the map that produce this.

Here's a screenshot

feature selected with control points

The code I use to generate the control is this:

_selectFeatureControl = new OpenLayers.Control.SelectFeature(
    _activeLayer,
    {
        clickout: true, 
        toggle: true,
        multiple: false, 
        hover: false,
        toggleKey: "ctrlKey", // ctrl key removes from selection
        multipleKey: "shiftKey" // shift key adds to selection
    }
 );

The layer generation code is:

layer = new OpenLayers.Layer.GML(
   displayName,
   url,
   {
       format: OpenLayers.Format.GeoJSON,
       isBaseLayer: false,
       visibility: true,

       styleMap: styleMap,

       projection: new OpenLayers.Projection("EPSG:4326")
   }
);                       

Thanks every one!

1
  • so you're not adding a ModifyFeature anywhere in your code?
    – Ilia Choly
    Commented Aug 4, 2011 at 19:45

1 Answer 1

0

try this:

var controls = map.getControlsByClass('OpenLayers.Control.ModifyFeature');
for(var i=0;i<controls.length;i++){
    controls[i].deactivate();
    controls[i].destroy();
}
2
  • Oh yeah! It worked! :) Thanks a lot!! I was using GeoExt to display a window with the feature' attributes, I guess the component I use automatically adds the modify feature control...
    – mokagio
    Commented Aug 5, 2011 at 8:30
  • In that case, you should dig into the GeoExt documentation to try and find it. I consider my solution a hack.
    – Ilia Choly
    Commented Aug 5, 2011 at 11:57

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.