SLD itself doesn't have a way to combine rules in the way you discuss.
GeoServer does offer filter functions that let you use if/then/else
constructs for individual properties, so you might be able to use that.
 Those filter functions don't have access to scale information, so you can't
use it for this specific case, but if you wanted to do something similar
based on feature attributes they could help.

There is also the CSS community module (disclaimer - I'm the maintainer so I
may be a bit biased :) which recombines rules according to a "cascading"
model similar to that used by your web browser to style HTML pages.  See
http://docs.geoserver.org/stable/en/user/community/css/index.html for more
info.

Your style would come out something like (I forgot whether I implemented
"1e9" style notation for the scale ranges, try spelling it out "1000000000"
if that doesn't work):

* {
  stroke: green, yellow, red, black;
  stroke-dasharray: 2 2;
}

* [@scale < 1e10][@scale > 1e9] {
  stroke-width: 8, 6, 4, 2;
}

* [@scale < 1e9] [@scale > 1e8] {
  stroke-width: 10, 8, 6, 4;
}

* [@scale < 1e8] [@scale > 1e7] {
  stroke-width: 12, 10, 8, 6
}

--
David Winslow
OpenGeo - http://opengeo.org/

On Thu, Mar 3, 2011 at 8:55 AM, Charles Galpin <[email protected]> wrote:

> I apologize in advance for not finding the spec and reading it, but I fear
> it would be a waste of time and an easy one for someone to answer anyway
> (probably with 2 letters).
>
> Is there a way to nest rules, or otherwise use more advanced control logic
> in SLD?
>
> I am making a stylesheet which wouldn't seem terribly hard but is turning
> out to be pretty verbose, currently at 1500 lines and will only get more
> verbose as I try fine tune the display. I essentially am controlling line
> styles based on the combinations and permutations of two attributes and zoom
> level.
>
> If I could nest the rules or do more advance control logic the psuedo code
> would look like this
>
> if data_type is historical then
>
>  for each green yellow red black do
>   draw a dashed line
>  do
>
> else
>
>  for each green yellow red black do
>   for each of about 5 different zoom levels do
>      draw a border line
>      draw a 2 pixel thinner colored line line
>   end
>  end
>
> end if
>
> But instead it's this and growing.
>
> <FeatureTypeStyle><Rule>Historical green zoom level
> 1</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical green zoom level
> 2</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical green zoom level
> 3</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical green zoom level
> 4</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical green zoom level
> 5</Rule></FeatureTypeStyle>
>
> <FeatureTypeStyle><Rule>Historical yellow zoom level
> 1</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical yellow zoom level
> 2</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical yellow zoom level
> 3</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical yellow zoom level
> 4</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical yellow zoom level
> 5</Rule></FeatureTypeStyle>
>
> <FeatureTypeStyle><Rule>Historical red zoom level
> 1</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical red zoom level
> 2</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical red zoom level
> 3</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical red zoom level
> 4</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical red zoom level
> 5</Rule></FeatureTypeStyle>
>
> <FeatureTypeStyle><Rule>Historical black zoom level
> 1</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical black zoom level
> 2</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical black zoom level
> 3</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical black zoom level
> 4</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Historical black zoom level
> 5</Rule></FeatureTypeStyle>
>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level 1
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level
> 1</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level 2
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level
> 2</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level 3
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level
> 3</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level 4
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level
> 4</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level 5
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical green zoom level
> 5</Rule></FeatureTypeStyle>
>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level 1
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level
> 1</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level 2
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level
> 2</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level 3
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level
> 3</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level 4
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level
> 4</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level 5
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical yellow zoom level
> 5</Rule></FeatureTypeStyle>
>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level 1
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level
> 1</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level 2
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level
> 2</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level 3
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level
> 3</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level 4
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level
> 4</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level 5
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical red zoom level
> 5</Rule></FeatureTypeStyle>
>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level 1
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level
> 1</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level 2
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level
> 2</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level 3
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level
> 3</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level 4
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level
> 4</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level 5
> border</Rule></FeatureTypeStyle>
> <FeatureTypeStyle><Rule>Non-Historical black zoom level
> 5</Rule></FeatureTypeStyle>
>
> tia,
> charles
>
>
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT
> data
> generated by your applications, servers and devices whether physical,
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to