Looking at various examples of how to use styles in OpenLayers, we have built
the following:
var Layer_AddressWebService_1 = new OpenLayers.Layer.Vector(
"AddressWebService_1",
{
styleMap: new OpenLayers.StyleMap(
{
"default": new OpenLayers.Style(
{
rules:
[
new OpenLayers.Rule(
{
symbolizer:
{
"Point":
{
pointRadius: 4,
graphicName: 'square',
fillColor: 'blue',
fillOpacity: 1,
strokeWidth: 1,
strokeOpacity: 1,
strokeColor: '#0000FF'
}
}
})
]
})
})
}, {
displayInLayerSwitcher: false,
isBaseLayer: false
}
);
We think this should resemble and hopefully be functionally identical to:
var awsSymbolizer = {
"Point": {
pointRadius: 4,
graphicName: "square",
fillColor: "blue",
fillOpacity: 1,
strokeWidth: 1,
strokeOpacity: 1,
strokeColor: "#0000FF"
}
};
var awsStyle = new OpenLayers.Style();
awsStyle.addRules([new OpenLayers.Rule({symbolizer: awsSymbolizer})]);
var awsStyleMap = new OpenLayers.StyleMap({"default": awsStyle});
var Layer_AddressWebService_1 = new
OpenLayers.Layer.Vector("AddressWebService_1",
{
styleMap: awsStyleMap
}, {
displayInLayerSwitcher: false,
isBaseLayer: false
});
But it is not. When using the latter, points are visualised fine, but using the
first part, results in nothing. The problem lies around the rules. Can anyone
tell me what the major difference is?
Regards Casper
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users