Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
            }}) }); 

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

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

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
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

Your Answer


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.