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.

In OpenLayers, I have a Vector layer with a StyleMap and SelectFeature and ModifyFeature controls, like this:

vector_layer = new OpenLayers.Layer.Vector('My Vector Layer', {extractAttributes: true,
            styleMap: new OpenLayers.StyleMap({'default':{
                strokeColor: "${customColor}",
                strokeOpacity: 1,
                strokeWidth: 2,
                fillColor: "${customColor}",
                fillOpacity: 0.5
            }}) }); 
map.addLayer(vector_layer);


selectControl = new OpenLayers.Control.SelectFeature(vector_layer,
                {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect});
map.addControl(selectControl);
selectControl.activate();
modify_control = new OpenLayers.Control.ModifyFeature(vector_layer);
map.addControl(modify_control);

When I tick a checkbox on the page, the ModifyFeature control is activated:

modify_control.activate();
modify_control.mode |= OpenLayers.Control.ModifyFeature.ROTATE;
modify_control.mode |= OpenLayers.Control.ModifyFeature.DRAG;

The problem is this: when I remove the StyleMap, ModifyFeature shows the handles to drag and rotate the feature. With the StyleMap, they are not visible. Any suggestions how to fix this? Thanks!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You have encountered the same problem I did, here is the question I asked. I'm convinced that this is a bug in OpenLayers and will be opening a bug tracker issue for it. In the meantime I have found a work around and have posted an answer against my original question. Take a look as it should give you what you need.

share|improve this answer
    
Yes, this issue gave me a headache. Thank you very much for your answer! –  Marvin80 Jul 28 '12 at 22:13
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.