I want to create an SLD which will be used for rendering shapefiles
describing powerlines and roads.
The case I am trying to test is a roads shapefile in which one of
the attributes of each feature is the the road type which I want to
display with different colors.
When trying to read the SLD I get a null pointer exception: at
org.geotools.filter.FilterDOMParser.parseFilter(FilterDOMParser.java:108)
at org.geotools.styling.SLDParser.parseRule(SLDParser.java:783)
at
org.geotools.styling.SLDParser.parseFeatureTypeStyle(SLDParser.java:710)
at org.geotools.styling.SLDParser.parseStyle(SLDParser.java:657)
at org.geotools.styling.SLDParser.readDOM(SLDParser.java:274)
at org.geotools.styling.SLDParser.readXML(SLDParser.java:251)
Any help would be greatly appreciated!
Thanx
gaby
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd"
version="1.0.0">
<!-- a named layer is the basic building block of an sld document -->
<NamedLayer>
<Name>Powerline</Name>
<title>A line representing a powerline</title>
<abstract>
Different types of lines that can be used to represent powerlines
</abstract>
<!-- within a layer you have Named Styles -->
<UserStyle>
<!-- again they have names, titles and abstracts -->
<Name>powerlines</Name>
<!-- FeatureTypeStyles describe how to render different features -->
<FeatureTypeStyle>
<!-- this describes the featureTypeName to apply this style to
i.e. river -->
<FeatureTypeName>line</FeatureTypeName>
<!-- the actual rule describes the style -->
<Rule>
<!-- these are lines so we need a line symbolizer -->
<LineSymbolizer>
<!-- A stroke describes how the line looks -->
<Stroke>
<!-- the CssParameters describe the actual style
you can set stroke (color of line), stroke-width,
stroke-opacity, stroke-linejoin
stroke-linecap, stroke-dasharray and stroke-dashoffset -->
<CssParameter name="stroke">#0000FF</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
<NamedLayer>
<Name>road</Name>
<title>A line representing a road</title>
<abstract>
Different types of lines that can be used to represent a road
</abstract>
<!-- within a layer you have Named Styles -->
<UserStyle>
<!-- again they have names, titles and abstracts -->
<Name>road_chc</Name>
<!-- FeatureTypeStyles describe how to render different features -->
<!-- this describes the featureTypeName to apply this style to e.g.
road -->
<FeatureTypeName>road_chc</FeatureTypeName>
<FeatureTypeStyle>
<Rule>
<!-- the actual rule describes the style -->
<Filter>NAME=metalled</Filter>
<!-- these are lines so we need a line symbolizer -->
<LineSymbolizer>
<!-- A stroke describes how the line looks -->
<Stroke>
<!-- the CssParameters describe the actual style
you can set stroke (color of line), stroke-width,
stroke-opacity, stroke-linejoin
stroke-linecap, stroke-dasharray and stroke-dashoffset -->
<CssParameter name="stroke">#FF0000</CssParameter>
<CssParameter name="width">2</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<!-- the actual rule describes the style -->
<Filter>NAME=unmetalled</Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#88FF00</CssParameter>
<CssParameter name="width">2</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
--
***************************************************************
** Gabriella Turek [EMAIL PROTECTED] **
** National Institute of Water & Atmospheric Research (NIWA) **
** PO Box 8602 Christchurch New Zealand +64-3-348-8987x3724 **
***************************************************************
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users