[OpenLayers-Users] Context is undefined and missing part of feature
emmexx
emmexx at tiscalinet.it
Thu Dec 10 10:10:16 EST 2009
I'm having some trouble using a Vector layer and the
addUniqueValueRules() function.
I create an array of vector layers and define a lookup rule to style
some feature (lines).
var myStyles = new OpenLayers.StyleMap({
"default": new OpenLayers.Style(null, {
rules: [
new OpenLayers.Rule({
symbolizer: {
"Point": {
pointRadius: 5,
graphicName: "square",
fillColor: "white",
fillOpacity: 0.25,
strokeWidth: 1,
strokeOpacity: 1,
strokeColor: '#' + color,
},
"Line": {
strokeDashstyle: ol_dash,
strokeWidth: 5,
strokeOpacity: 1,
fillColor: "white",
strokeColor: '#' + color,
label: mylabel,
labelAlign: "rm",
fontSize: "12px",
fontWeight: "bold",
fontColor: '#' + label }
}
})
]
})
});
myStyles.addUniqueValueRules("default", "attr1", attr1);
myStyles.addUniqueValueRules("default", "attr2", attr2);
In another layer I load a gpx file:
vlayer2= new OpenLayers.Layer.GML("gps", path,
{
format: filetype
formatOptions: {
extractAttributes: false,
extractStyles: false,
maxDepth: 2,
extractTracks: true,
extractRoutes: false,
extractWaypoints: false
},
'styleMap': styleMap,
projection: map.displayProjection
});
If gpx line is outside the visible map I drag the map but the line is
not "refreshed" and the previously hidden part is not visible. I have
to, for example, zoom in and out to get the line visible.
If I comment out the 2 addUniqueValueRules lines the problem disappear.
No problem also if I debug the code in Firebug and put a breakpoint on
one of those 2 lines.
After dragging the map in ff error console I find:
context is undefined
.../Openlayers-2.8/Openlayers.js Line 1423.
Any suggestion?
Thank you
maxx
p.s. I cut the unnecessary code
More information about the Users
mailing list