Search code examples
openlayersgmlgeojson

OpenLayers Select Feature with control points


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!


Solution

  • try this:

    var controls = map.getControlsByClass('OpenLayers.Control.ModifyFeature');
    for(var i=0;i<controls.length;i++){
        controls[i].deactivate();
        controls[i].destroy();
    }