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

Attachment: pgpjilKnjKVOa.pgp
Description: PGP signature

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to