[OpenLayers-Users] Need advice regarding styling vector points

Arnd Wippermann arnd.wippermann at web.de
Sat Mar 7 15:51:56 EST 2009


Hi 

you can use rules with OpenLayers.Filter.Comparison.BETWEEN

var aStyleMap = new OpenLayers.StyleMap();

var rules = [];
rules.push(new OpenLayers.Rule({
    symbolizer: {fillOpacity:0,
pointRadius:3,strokeWidth:2,strokeColor:"aquamarine"},
    filter: new OpenLayers.Filter.Comparison({
        type: OpenLayers.Filter.Comparison.BETWEEN,
        lowerBoundary : 1,
        upperBoundary : 3,
        property: "popclass"
    })
}));
rules.push(new OpenLayers.Rule({
    symbolizer: {fillOpacity:1,
fillColor:"FFAAAA",pointRadius:5,strokeWidth:2,strokeColor:"red"},
    filter: new OpenLayers.Filter.Comparison({
        type: OpenLayers.Filter.Comparison.BETWEEN,
        lowerBoundary : 10,
        upperBoundary : 11,
        property: "popclass"
    })
}));
rules.push(new OpenLayers.Rule({
    symbolizer: {fillOpacity:0,
pointRadius:5,strokeWidth:2,strokeColor:"FF8000"},
    elseFilter: true
}));

aStyleMap.styles["default"].addRules(rules);
vectorLayer.styleMap = aStyleMap;
vectorLayer.redraw();
 
Arnd Wippermannn

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Zer
Gesendet: Samstag, 7. März 2009 21:12
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] Need advice regarding styling vector points




Arnd Wippermann wrote:
> 
> Hi,
> 
> You can use addUniqueValueRules to style your features on an attribute 
> value. To change the visibility, you can generate new rules.
> 
> I have used this approach
> http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/styles_unique
> _with_
> group.html
> 
> But with 1000 features there could be a performance problem.
> 
> Arnd Wippermann
> 
> 
> 


Hi!

Thanks, for your reply. I don't have a 1000 unique features, I have around
20 features with a attribute (value) ranging from 0 to 1000. I want to show
the features with attribute value 0-99 in one colour and the ones with
attribute values 100-1000 in another colour. And be able to toggle between
showing  just one of the groups  on the map, or both groups together. So
there are no unique values.

-Z
--
View this message in context:
http://n2.nabble.com/Need-advice-regarding-styling-vector-points-tp2441146p2
441820.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