Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

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

When I use drag feature, then the circles on the polygon edge has the same style. For example, this OpenLayers site.

I need to change it, I mean they need to be a different color.

What is their (cycles) style attribute?

share|improve this question
up vote 8 down vote accepted

You should use vertexRenderIntent property of ModifyFeature control. For example:

var vertexStyle = {
    strokeColor: "#ff0000",
    fillColor: "#ff0000",
    strokeOpacity: 1,
    strokeWidth: 2,
    pointRadius: 3,
    graphicName: "cross"

var styleMap = new OpenLayers.StyleMap({
    "vertex": vertexStyle
}, {extendDefault: false});

var layer = new OpenLayers.Layer.Vector('features', {styleMap: styleMap});
map.addControl(new OpenLayers.Control.ModifyFeature(layer, {vertexRenderIntent: "vertex"}));

At result we have the following style:

enter image description here

share|improve this answer

The approach outlined by @drnextgis is the correct one to follow. However, be aware that there is currently a bug in OpenLayers (as of version 2.11) that means if you add a unique values renderer to the StyleMap using the addUniqueValueRules method then the drag handles will disappear.

If you encounter this please look at my question for details of how to work around it.

share|improve this answer

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.