im trying to apply rules, where the data is fetched from an external database. This is my code:
// create a new style and add rules var defStyle = new OpenLayers.Style({ strokeWidth: 1 });
defStyle.addRules([
new OpenLayers.Rule({
symbolizer: {
fillColor: "#ffeecc"
},
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LESS_THAN,
property: "order07",
value: "04000"
})
}),
new OpenLayers.Rule({
symbolizer: {
fillColor: "#ffcc99"
},
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.BETWEEN,
property: "order07",
lowerBoundary: "04000",
upperBoundary: "08000"
})
}),
new OpenLayers.Rule({
symbolizer: {
fillColor: "#ff9966"
},
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.BETWEEN,
property: "order07",
lowerBoundary: "08000",
upperBoundary: "11000"
})
}),
]);
var selStyle = new OpenLayers.Style({
fillColor: "#ffaa00"
});
// combine styles in a style map
var myStyleMap = new OpenLayers.StyleMap({
"default": defStyle,
"select": selStyle
});
what i want to do is something like this:
I have a database with
ID| Name
1 | Bob
2 | Sam
and i want the rules getting applied according to one of those values. Is it possible to include external database information that is not in the shapefile ??
In spoken words the original rule is "Color all vectors where the property:order07 is less than value:04000 with the color #ffeecc"
and i want to change it into something like "Color the vectors where the property:fromDatabase xy: is value:xxyy with the color #xxxxxx"