[OpenLayers-Users] 'undefined' at vertices while editing vector
layer
Alex Dean
alex at crackpot.org
Mon Aug 30 10:09:48 EDT 2010
When I define my own styling for a vector layer, I see 'undefined' at
the vertices while editing a feature.
Screenshot of feature when I'm not editing it : http://skitch.com/alexdean/dwe1i/without-editing
Screenshot of feature while editing: http://skitch.com/alexdean/dwe14/with-editing
Using Firebug/Firefox, I can see the following SVG for one vertex.
<circle id="OpenLayers.Geometry.Point_146" cx="827.6666666759318"
cy="79.09283407817736" r="6" fill="undefined" fill-opacity="0.5"
stroke="undefined" stroke-opacity="0.8" stroke-width="4" stroke-
linecap="round" stroke-linejoin="round" stroke-dasharray="none"/>
I see 'undefined' is the value use for 'fill' and 'stroke', so I
imagine one of these may be the problem. I can't figure out what keys
I need to define in my style objects to resolve this problem. Can
someone help?
This is how I've defined the layer:
wfs = new OpenLayers.Layer.Vector("Regions", {
styleMap: new OpenLayers.StyleMap( {
'default':{
label: "${name}",
fillColor: "${color}",
fillOpacity: 0.5,
strokeColor: "${color}",
strokeOpacity: 0.8,
strokeWidth: 4,
pointRadius: 6,
fontColor: "#000000",
fontSize: "24px",
fontFamily: "Courier New, monospace",
fontWeight: "bold"
}
})
});
The edit control is defined as follows:
var edit = new OpenLayers.Control.ModifyFeature(wfs, {
title: "Edit Existing Region",
displayClass: "olControlModifyFeature"
});
As you can see in the screenshots, the 'color' attribute (eg "$
{color}") has been set for the feature in question and is rendered
correctly when I'm not editing the feature. The 'undefined' text only
appears when I edit the feature using an instance of
OpenLayers.Control.ModifyFeature.
thanks,
alex
More information about the Users
mailing list