All

I've been attempting with not much luck to get a database property to control 
our map's line-style (i.e. dots, dashes etc) through SLD. If I use:

<sld:CssParameter 
name="stroke-dasharray"><ogc:PropertyName>DASHARRAY</ogc:PropertyName></sld:CssParameter>

...the line always ends up as solid, as if it's completely ignoring the 
property (or possibly the whole rule), even though the GeoServer logs do not 
indicate a problem. If I specify the stroke-dasharray explicitly, like this:

<sld:CssParameter name="stroke-dasharray">5 2</sld:CssParameter>

...then the whole SLD works perfectly, but obviously with a fixed dash, which 
is not what I want. The underlying table has a field called 'DASHARRAY' which 
contains values such as '5 1', '5 2 3 2','none' etc etc. The first rule below 
takes the records where DASHARRAY doesn't equal 'none' and ties to assign the 
DASHARRAY value to the CSS -  the second rule takes the DASHARRAY 'none' 
records and processes them without the stroke-dasharray element

If anyone knows how to successfully achieve this, please let me know. I've 
included below both the SLD and a sample of the data in the DASHARRAY database 
field:

SLD

<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld"; 
xmlns:sld="http://www.opengis.net/sld"; xmlns:ogc="http://www.opengis.net/ogc"; 
xmlns:gml="http://www.opengis.net/gml"; version="1.0.0">
<sld:NamedLayer>
<sld:Name>SWW_StyledLines</sld:Name>
<sld:UserStyle>
<sld:Name>SWW_StyledLines</sld:Name>
<sld:Title>SWW styled lines</sld:Title>
<sld:IsDefault>1</sld:IsDefault>
<sld:Abstract>SWW styled lines</sld:Abstract>
<sld:FeatureTypeStyle>
<sld:Name>TSColouredAndStyledByData</sld:Name>
<sld:Rule>
<sld:Name>Rule 1</sld:Name>
<sld:Title>ColouredAndStyledByDataDashed</sld:Title>
<sld:Abstract>Colour and style in fields MS_WEIGHT, HEXCOLOR and 
DASHARRAY</sld:Abstract>
<sld:MinScaleDenominator>1</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>100000.0</sld:MaxScaleDenominator>
<ogc:Filter>
<ogc:PropertyIsNotEqualTo>

<ogc:PropertyName>DASHARRAY</ogc:PropertyName>

<Literal>none</Literal>
</ogc:PropertyIsNotEqualTo>
</ogc:Filter>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter 
name="stroke"><ogc:PropertyName>HEXCOLOR</ogc:PropertyName></sld:CssParameter>
<sld:CssParameter 
name="stroke-width"><ogc:PropertyName>MS_WEIGHT</ogc:PropertyName></sld:CssParameter>
<sld:CssParameter 
name="stroke-dasharray"><ogc:PropertyName>DASHARRAY</ogc:PropertyName></sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>
<sld:Rule>
<sld:Name>Rule 2</sld:Name>
<sld:Title>ColouredAndStyledByDataSolid</sld:Title>
<sld:Abstract>Colour and style in fields MS_WEIGHT, HEXCOLOR</sld:Abstract>
<sld:MinScaleDenominator>1</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>100000.0</sld:MaxScaleDenominator>
<ogc:Filter>
<ogc:PropertyIsEqualTo>

<ogc:PropertyName>DASHARRAY</ogc:PropertyName>

<Literal>none</Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter 
name="stroke"><ogc:PropertyName>HEXCOLOR</ogc:PropertyName></sld:CssParameter>
<sld:CssParameter 
name="stroke-width"><ogc:PropertyName>MS_WEIGHT</ogc:PropertyName></sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>

</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>

Sample data from DASHARRAY field (Oracle varchar2(20))

none
4 1
4 1
5 2 1 2
5 2 1 2
5 2 1 2
4 1
4 1
5 2 1 2
4 1
4 1
5 2 1 2
5 2 1 2
none
4 1
none
none
5 2 1 2



Thanks

Spencer Jones
GIS Tech Admin
South West Water


________________________________________________________
The information and documents sent in this email from South West Water Ltd are 
sent in confidence and are intended only for the use of the individual or 
entity named above. Please note that the contents may contain privileged, 
personal and/or confidential information and are not to be disclosed to any 
person other than the addressee. If you are not the intended recipient you are 
notified that any use, dissemination, distribution or copying of the 
information and documents contained in this email is strictly prohibited. If 
you have received this email in error, please return it and any copies 
immediately, without reading any attachments, and confirm that immediately upon 
returning the email, you will delete all copies on your system and network. 
South West Water Limited - Registered in England No: 2366665
Registered Office:
Peninsula House
Rydon Lane
Exeter
Devon  EX2 7HR
________________________________________________________

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to