[Geoserver-users] SLD Line rendering

Hi all,

Is it possible to render lines as one colour with a border? Specifically I’m working on an .sld for the Open Street Map data and for the roads I want them to show as coloured lines but on the closer zoom levels they also need to have a thin grey line on each side. Having looked at the .sld guide it doesn’t look like this is possible unless I use an image to render the lines, in which case I assume I would need a cross-section image of the road, i.e. 1 pixel wide 5 long, grey, red, red, red, grey would give a 3 px wide red line with grey border. Is this the way to go or have I missed the easy way?

cheers,

Tom

Hi Tom,

I think you can just use two line symbolizers, and one will be drawn on
top of the other.

<Rule>
<!-- thick line drawn first-->
<MaxScaleDenominator>32000</MaxScaleDenominator>
<LineSymbolizer>
  <Stroke>
   <CssParameter name="stroke">
    <ogc:Literal>#666666</ogc:Literal>
   </CssParameter>
   <CssParameter name="stroke-width">
    <ogc:Literal>7</ogc:Literal>
   </CssParameter>
  </Stroke>
</LineSymbolizer>
</Rule>

<Rule>
<!-- thin line drawn second -->
<MaxScaleDenominator>32000</MaxScaleDenominator>
<LineSymbolizer>
  <Stroke>
   <CssParameter name="stroke">
    <ogc:Literal>#FFFFFF</ogc:Literal>
   </CssParameter>
   <CssParameter name="stroke-width">
    <ogc:Literal>4</ogc:Literal>
   </CssParameter>
  </Stroke>
</LineSymbolizer>
</Rule>

-Justin

Tom (JDi Solutions) wrote:

Hi all,

Is it possible to render lines as one colour with a border?
Specifically I'm working on an .sld for the Open Street Map data and for
the roads I want them to show as coloured lines but on the closer zoom
levels they also need to have a thin grey line on each side. Having
looked at the .sld guide it doesn't look like this is possible unless I
use an image to render the lines, in which case I assume I would need a
cross-section image of the road, i.e. 1 pixel wide 5 long, grey, red,
red, red, grey would give a 3 px wide red line with grey border. Is
this the way to go or have I missed the easy way?

cheers,

Tom
!DSPAM:4007,4700c8ef86594901796417!

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

!DSPAM:4007,4700c8ef86594901796417!

------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,4700c8ef86594901796417!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Hi,

you can achieve this by having two overlapping line styles, the first
one dark and slightly wider than the second. The tiger roads in the demo
dataset use this technique.

Note that (according to me, not confirmed) this is broken in 1.6beta3 if
your data comes from Postgis. See
http://jira.codehaus.org/browse/GEOS-1362 , which also includes an SLD
that illustrates how to create the effect.

-Arne

Tom (JDi Solutions) wrote:

Hi all,

Is it possible to render lines as one colour with a border?
Specifically I'm working on an .sld for the Open Street Map data and
for the roads I want them to show as coloured lines but on the closer
zoom levels they also need to have a thin grey line on each side.
Having looked at the .sld guide it doesn't look like this is possible
unless I use an image to render the lines, in which case I assume I
would need a cross-section image of the road, i.e. 1 pixel wide 5
long, grey, red, red, red, grey would give a 3 px wide red line with
grey border. Is this the way to go or have I missed the easy way?

cheers,

Tom
!DSPAM:4038,4700c8f286571961014482!
------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

!DSPAM:4038,4700c8f286571961014482!
  
------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4038,4700c8f286571961014482!
  

Thanks guys, really appreciate it, that works a treat. :slight_smile:

On 10/1/07, Arne Kepp < ak@anonymised.com> wrote:

Hi,

you can achieve this by having two overlapping line styles, the first
one dark and slightly wider than the second. The tiger roads in the demo
dataset use this technique.

Note that (according to me, not confirmed) this is broken in 1.6beta3 if
your data comes from Postgis. See
http://jira.codehaus.org/browse/GEOS-1362 , which also includes an SLD
that illustrates how to create the effect.

-Arne

Tom (JDi Solutions) wrote:

Hi all,

Is it possible to render lines as one colour with a border?
Specifically I’m working on an .sld for the Open Street Map data and
for the roads I want them to show as coloured lines but on the closer
zoom levels they also need to have a thin grey line on each side.
Having looked at the .sld guide it doesn’t look like this is possible
unless I use an image to render the lines, in which case I assume I
would need a cross-section image of the road, i.e. 1 pixel wide 5
long, grey, red, red, red, grey would give a 3 px wide red line with
grey border. Is this the way to go or have I missed the easy way?

cheers,

Tom
!DSPAM:4038,4700c8f286571961014482!


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

!DSPAM:4038,4700c8f286571961014482!



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4038,4700c8f286571961014482!

One further question on this if I may? The technique you described works great, putting the border colour style first ensures that it is always rendered first and then partially covered by the coloured line. There are however quite a few different types of road to render and they have a clear order of priority but their order in the sld doesn’t seem to affect which gets rendered first, presumably this is because they are first selected from the table according to their type and then the renderer just works through the query results and only uses the order of the sld file when a feature comes up which actually has 2 rules which apply to it. Is that understanding correct? Is there anything that can be done to ensure things are rendered in order of priority?

On 10/2/07, Tom (JDi Solutions) <tom.dean@anonymised.com> wrote:

Thanks guys, really appreciate it, that works a treat. :slight_smile:

On 10/1/07, Arne Kepp < ak@anonymised.com> wrote:

Hi,

you can achieve this by having two overlapping line styles, the first
one dark and slightly wider than the second. The tiger roads in the demo
dataset use this technique.

Note that (according to me, not confirmed) this is broken in 1.6beta3 if
your data comes from Postgis. See
http://jira.codehaus.org/browse/GEOS-1362 , which also includes an SLD
that illustrates how to create the effect.

-Arne

Tom (JDi Solutions) wrote:

Hi all,

Is it possible to render lines as one colour with a border?
Specifically I’m working on an .sld for the Open Street Map data and
for the roads I want them to show as coloured lines but on the closer
zoom levels they also need to have a thin grey line on each side.
Having looked at the .sld guide it doesn’t look like this is possible
unless I use an image to render the lines, in which case I assume I
would need a cross-section image of the road, i.e. 1 pixel wide 5
long, grey, red, red, red, grey would give a 3 px wide red line with
grey border. Is this the way to go or have I missed the easy way?

cheers,

Tom
!DSPAM:4038,4700c8f286571961014482!


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

!DSPAM:4038,4700c8f286571961014482!



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4038,4700c8f286571961014482!

How are you telling Geoserver to distinguish between them? Are they all
the same featuretype, and you are using filters in the SLD file... or
something else? (I'm a newbie, I am sure there are lots of ways of doing
things that I haven't heard of yet)

I am looking at a dataset where everything is classified as "paved
road", so I am looking into the same type of problem, but I haven't
started worrying about drawing order yet.

-Arne

Tom (JDi Solutions) wrote:

One further question on this if I may? The technique you described
works great, putting the border colour style first ensures that it is
always rendered first and then partially covered by the coloured
line. There are however quite a few different types of road to render
and they have a clear order of priority but their order in the sld
doesn't seem to affect which gets rendered first, presumably this is
because they are first selected from the table according to their type
and then the renderer just works through the query results and only
uses the order of the sld file when a feature comes up which actually
has 2 rules which apply to it. Is that understanding correct? Is
there anything that can be done to ensure things are rendered in order
of priority?

On 10/2/07, *Tom (JDi Solutions)* <tom.dean@anonymised.com
<mailto:tom.dean@anonymised.com>> wrote:

    Thanks guys, really appreciate it, that works a treat. :slight_smile:

    On 10/1/07, *Arne Kepp* < ak@anonymised.com
    <mailto:ak@anonymised.com>> wrote:

        Hi,

        you can achieve this by having two overlapping line styles,
        the first
        one dark and slightly wider than the second. The tiger roads
        in the demo
        dataset use this technique.

        Note that (according to me, not confirmed) this is broken in
        1.6beta3 if
        your data comes from Postgis. See
        http://jira.codehaus.org/browse/GEOS-1362 , which also
        includes an SLD
        that illustrates how to create the effect.

        -Arne

        Tom (JDi Solutions) wrote:
        > Hi all,
        >
        > Is it possible to render lines as one colour with a border?
        > Specifically I'm working on an .sld for the Open Street Map
        data and
        > for the roads I want them to show as coloured lines but on
        the closer
        > zoom levels they also need to have a thin grey line on each side.
        > Having looked at the .sld guide it doesn't look like this is
        possible
        > unless I use an image to render the lines, in which case I
        assume I
        > would need a cross-section image of the road, i.e. 1 pixel wide 5
        > long, grey, red, red, red, grey would give a 3 px wide red
        line with
        > grey border. Is this the way to go or have I missed the easy
        way?
        >
        > cheers,
        >
        > Tom
        >
        > ------------------------------------------------------------------------

        >
        > -------------------------------------------------------------------------
        > This SF.net email is sponsored by: Microsoft
        > Defy all challenges. Microsoft(R) Visual Studio 2005.
        > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
        >
        > !DSPAM:4038,4700c8f286571961014482!
        >
        > ------------------------------------------------------------------------
        >
        > _______________________________________________
        > Geoserver-users mailing list
        > Geoserver-users@lists.sourceforge.net
        <mailto:Geoserver-users@lists.sourceforge.net>
        > https://lists.sourceforge.net/lists/listinfo/geoserver-users
        >
        >
        > !DSPAM:4038,4700c8f286571961014482!
        >

!DSPAM:4038,4702071d154165210051143!

Yes, they’re all the same feature type with a filter to distinguish between them on the basis of one of the columns. The only way I’ve thought of thus far is to sort a view at the database end to ensure the records come out in the right order but I don’t actually know if that’s going to work since I know “order by” is not part of the SQL standard for views so I’m not sure Oracle will allow it. Besides, it’s a bit of a pain to do that since there’s no column to just sort on, I’d have to create a column with a sort key.

I’m going to have another look at the SLD spec later to see if there’s anything in there…

On 10/2/07, Arne Kepp < ak@anonymised.com> wrote:

How are you telling Geoserver to distinguish between them? Are they all
the same featuretype, and you are using filters in the SLD file… or
something else? (I’m a newbie, I am sure there are lots of ways of doing
things that I haven’t heard of yet)

I am looking at a dataset where everything is classified as “paved
road”, so I am looking into the same type of problem, but I haven’t
started worrying about drawing order yet.

-Arne

Tom (JDi Solutions) wrote:

One further question on this if I may? The technique you described
works great, putting the border colour style first ensures that it is
always rendered first and then partially covered by the coloured
line. There are however quite a few different types of road to render
and they have a clear order of priority but their order in the sld
doesn’t seem to affect which gets rendered first, presumably this is
because they are first selected from the table according to their type
and then the renderer just works through the query results and only
uses the order of the sld file when a feature comes up which actually
has 2 rules which apply to it. Is that understanding correct? Is
there anything that can be done to ensure things are rendered in order
of priority?

On 10/2/07, Tom (JDi Solutions) <tom.dean@anonymised.com
mailto:[tom.dean@anonymised.com](mailto:tom.dean@anonymised.com)> wrote:

Thanks guys, really appreciate it, that works a treat. :slight_smile:

On 10/1/07, Arne Kepp < ak@anonymised.com
mailto:[ak@anonymised.com](mailto:ak@anonymised.com)> wrote:

Hi,

you can achieve this by having two overlapping line styles,
the first
one dark and slightly wider than the second. The tiger roads
in the demo
dataset use this technique.

Note that (according to me, not confirmed) this is broken in
1.6beta3 if
your data comes from Postgis. See
http://jira.codehaus.org/browse/GEOS-1362 , which also
includes an SLD
that illustrates how to create the effect.

-Arne

Tom (JDi Solutions) wrote:

Hi all,

Is it possible to render lines as one colour with a border?
Specifically I’m working on an .sld for the Open Street Map
data and
for the roads I want them to show as coloured lines but on
the closer
zoom levels they also need to have a thin grey line on each side.
Having looked at the .sld guide it doesn’t look like this is
possible
unless I use an image to render the lines, in which case I
assume I
would need a cross-section image of the road, i.e. 1 pixel wide 5
long, grey, red, red, red, grey would give a 3 px wide red
line with
grey border. Is this the way to go or have I missed the easy
way?

cheers,

Tom



This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

!DSPAM:4038,4700c8f286571961014482!



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
mailto:[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@lists.sourceforge.net)
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4038,4700c8f286571961014482!

!DSPAM:4038,4702071d154165210051143!

I tried it myself, I agree it doesn't seem to care about the order of
the filtered styles.

WMS has a way of specifying an ordered list of layers and an ordered
list of corresponding styles. It may be possible to request the same
layer twice, but apply different stylesheets. The spec says the server
must render in order from left to right.

I am considering splitting up the table, i.e. move major arteries into a
separate table with the same columns, mostly to make some other tweaking
easier.

-Arne

Tom (JDi Solutions) wrote:

Yes, they're all the same feature type with a filter to distinguish
between them on the basis of one of the columns. The only way I've
thought of thus far is to sort a view at the database end to ensure
the records come out in the right order but I don't actually know if
that's going to work since I know "order by" is not part of the SQL
standard for views so I'm not sure Oracle will allow it. Besides,
it's a bit of a pain to do that since there's no column to just sort
on, I'd have to create a column with a sort key.

I'm going to have another look at the SLD spec later to see if there's
anything in there...

...............

!DSPAM:4038,47024e2b219295332866982!

I can also confirm that running this from a sorted query works too. The renderer obviously renders stuff in the order it is given it by the database so if the database returns it in order it gets rendered in order. Not sure that has completely solved my problem but it has helped.

On 10/2/07, Arne Kepp <ak@anonymised.com> wrote:

I tried it myself, I agree it doesn’t seem to care about the order of
the filtered styles.

WMS has a way of specifying an ordered list of layers and an ordered
list of corresponding styles. It may be possible to request the same
layer twice, but apply different stylesheets. The spec says the server
must render in order from left to right.

I am considering splitting up the table, i.e. move major arteries into a
separate table with the same columns, mostly to make some other tweaking
easier.

-Arne

Tom (JDi Solutions) wrote:

Yes, they’re all the same feature type with a filter to distinguish
between them on the basis of one of the columns. The only way I’ve
thought of thus far is to sort a view at the database end to ensure
the records come out in the right order but I don’t actually know if
that’s going to work since I know “order by” is not part of the SQL
standard for views so I’m not sure Oracle will allow it. Besides,
it’s a bit of a pain to do that since there’s no column to just sort
on, I’d have to create a column with a sort key.

I’m going to have another look at the SLD spec later to see if there’s
anything in there…

!DSPAM:4038,47024e2b219295332866982!

Tom (JDi Solutions) ha scritto:

One further question on this if I may? The technique you described works great, putting the border colour style first ensures that it is always rendered first and then partially covered by the coloured line. There are however quite a few different types of road to render and they have a clear order of priority but their order in the sld doesn't seem to affect which gets rendered first, presumably this is because they are first selected from the table according to their type and then the renderer just works through the query results and only uses the order of the sld file when a feature comes up which actually has 2 rules which apply to it. Is that understanding correct? Is there anything that can be done to ensure things are rendered in order of priority?

Afaik the only way to make sure features are rendered in a certain order
is to specify each type in a different feature type style, because
that's the only part of SLD that mandates an order.

If you specify all rules within the same feature type style, the SLD
requires that each feature goes thru all of the rules and be painted
only by those whose filter match, but there is no "layer" ordering
implied.

There is a downside thought. GeoServer uses multiple image back buffers
to renderer a map with more than one feature type style to avoid making
a different query to the db for each of them (it's a performance
optimization). The images are then merged when rendering ends, but the thing is, the memory requirement for many fts in a single SLD can
skyrocket pretty fast. See also http://jira.codehaus.org/browse/GEOS-1372

Cheers
Andrea