[OpenLayers-Users] Styling with SLDs and Clustering
Michael Prieß
mailinglisteprm at googlemail.com
Fri Feb 11 05:30:18 EST 2011
Hi all,
i have to show a lot of icons inside my map and used clustering to realize
this.So i started to load all my icons from the WFS with the other
attributes that styling related.
For filtering i use a style map at the moment. So i do all the styling logic
with rules. What i doesn't like on this way is, that the styling rules
inside my code and that i have to use a fixed graphicHeight and
graphicWidth.
Can i use something like the SLD bellow to do all the styling stuff that i
like to do ? Have anyone an example which us ExternalGraphic ?
<Rule>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>category</ogc:PropertyName>
<ogc:Literal>61</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:type="simple"
xlink:href="./resources/img/traffic/iconSmall62.png"/>
<Format>image/png</Format>
</ExternalGraphic>
<Mark/>
</Graphic>
</PointSymbolizer>
</Rule>
Stylemap Example:
var infoStyle = new OpenLayers.Style(
// the first argument is a base symbolizer
// all other symbolizers in rules will extend this one
{
},
{
rules: [
new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.GREATER_THAN,
property: "count", // the "foo" feature attribute
value: 1
}),
symbolizer: {
externalGraphic: "./resources/img/cluster.png",
label: "${count}",
graphicWidth: 25,
graphicHeight: 25
}
}),
new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "category", // the "foo" feature attribute
value: 62
}),
symbolizer: {
externalGraphic:
"./resources/img/traffic/iconSmall62.png",
graphicWidth: 25,
graphicHeight: 25
}
}),
etc...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110211/6e0a2fa8/attachment-0001.html
More information about the Users
mailing list