[OpenLayers-Users] Zoom-based feature styling
Mak Kolybabi
mak.kolybabi at telenium.ca
Tue Dec 29 11:19:16 EST 2009
I expect that there's an easy way to do this, but it so far eludes me. I have an
OpenLayers.Layer.Vector object called "icons". Each feature in this layer has
two attributes that I need to worry about: type and zoom. There are fifty
different types, and five different zooms, so far. I already have type-based
styling using:
new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "type",
value: "type_1"
}),
symbolizer: {
externalGraphic: "/path/to/images/1.png",
graphicHeight: 25,
graphicWidth: 25,
graphicOpacity: 1.0
}
}));
I realize I could use max/minScaleDenominator to restrict zooms, but 5x50 rules
is excessive. What I'm looking for is something like:
new OpenLayers.Rule({
filter: new OpenLayers.Filter.Logical({
filters: [
new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "type",
value: "type_1"
}),
new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,
property: "zoom",
value: map.zoom
})
],
type: OpenLayers.Filter.Logical.AND
}),
symbolizer: {
externalGraphic: "/path/to/images/1.png",
graphicHeight: 25,
graphicWidth: 25,
graphicOpacity: 1.0
}
}));
Except where map.zoom is dynamically evaluated, instead of it being evaluated
only when the style is created.
Any ideas or suggestions are appreciated.
--
Mak Kolybabi
Programmer
Telenium Inc.
204-957-2821
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091229/54d88f1c/attachment.bin
More information about the Users
mailing list