[OpenLayers-Users] turn features on and off

Pierre GIRAUD bluecarto at gmail.com
Wed Oct 8 07:22:00 EDT 2008


Hi,

The "styles-unique" example should help you.
http://www.openlayers.org/dev/examples/styles-unique.html

styleMap.addUniqueValueRules is probably worth trying in your case.

Let's say your layer features data contains an attribute "animal" with
values like ["cheetah", "lion", "monkey", ...]
Using something like the following code should draw only the "cheetah" points :

var lookup = {
                'cheetah': {externalGraphic: "../img/marker-blue.png"}
            }
styleMap.addUniqueValueRules("default", "animal", lookup);

Maybe, it's not the better way to achieve your goal. It should work
though. I implemented something similar myself for touristic POIs.

Regards,
Pierre




On Wed, Oct 8, 2008 at 12:12 PM, zoggo <zoegge at gmx.ch> wrote:
>
> Hi,
>
> I'm running a small GIS-Application with OpenLayers. I have a Vector Layer
> with points. The points are attributet with different kind of animals. I'd
> like to turn off a group of animals (a group of points declared by there
> attribute). It's not enough to turn them off by opacity because they
> shouldn't be selectable. Does some one have a solution for this?
>
> Thanks for help!
> --
> View this message in context: http://n2.nabble.com/turn-features-on-and-off-tp1306205p1306205.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list