package org.geotools.styling
Allows for symbolization of geospatial data.
For many of us in geotools *this* is the reason we came along for the ride -
a pretty picture. The contents of this package are adapted from the
OpenGIS® Styled Layer Descriptor
specification v1.0.0.
Conformance to SLD 1.0.0
We may experiment with our own (or SLD 1.1) ideas but will mark such
experiments for you. This is only an issue of you are considering writing out
these objects for interoptability with other systems.
General stratagy for supporting multiple SLD versions (and experiments):
These interfaces will reflect the current published specification
Our implementations will be BIGGER and more capabile then any
one specification
We cannot defined explicit interfaces tracking each version until we
move to Java 5 (perferably GeoAPI would hold these anyways)
We can provided javadocs indicating extentions, and isolate these using
the normal java convention: TextSymbolizer and TextSymbolizer2 (In short you
will have to go out of your way to work with a hack or experiment, you won't
depend on one by accident)
We can use Factories (aka SLD1Factory and SLD1_1Factory and SEFactory)
to support the creation of conformant datastructures. Code (such as user
interfaces) can be parameratized with these factories when they need to
confirm to an exact version supported by an individual service. We hope that
specifications are always adative, and will be forced to throw unsupported
exceptions when functionality is removed from a specification.
Care and Feeding of Style Objects
SLD is an XML specification, the definition of objects capturing this information,
the binding of objects to these XML documents, and the provision of events
on object modification all need to be accounted for.
StyleFactory
As with all geotools work construction of styling constructs is handled by a
Factory(GOF). Quickly a Factory is used when working with interfaces,
anything that would of been a constructor is set up as an create method.
StyleFactory factory = StyleFactoryFinder.createStyleFactory();
StyleLayerDescriptor sld = factory.createStyleLayerDescriptor();
// an empty sld document
sld.setTitle("Basic Black");
sld.setAbstract("Grayscale style suitable for use with photocopiers");
When creating a complex data structure direct use of a Factory is a pain.
Which leads us to the next section.
Notes:
At this time one implementation of StyleFactory is available, this will
not provide true in the future (as SLD experiments, and code generation
are brought to bare on future specifications).
StyleBuilder
When constructing a complex data structure, such as an SLD document, the use
of a Factory is a bit of a pain. That is where StyleBuilder is brought
to bare. A Builder is simply a class that help you construct a complicated
data structure, for a make involved/interesting example of a builder have a look
at the graph package.
Example
The following code example has been borrowed from the geotools website,
for additional examples (and advice) please consult the user documentation.
The ChannelSelection element specifies the false-color channel selection for
a multi-spectral raster source (such as a multi-band satellite-imagery
source).
<xsd:element name="Fill">
<xsd:annotation>
<xsd:documentation>
A "Fill" specifies the pattern for filling an area geometry.
The allowed CssParameters are: "fill" (color) and "fill-opacity".
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="sld:GraphicFill" minOccurs="0"/>
<xsd:element ref="sld:CssParameter" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Renderers can use this information when displaying styled features, though
it must be remembered that not all renderers will be able to fully
represent strokes as set out by this interface.
<xsd:element name="Halo">
<xsd:annotation>
<xsd:documentation>
A "Halo" fills an extended area outside the glyphs of a rendered
text label to make the label easier to read over a background.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="sld:Radius" minOccurs="0"/>
<xsd:element ref="sld:Fill" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Renderers can use this information when displaying styled features, though
it must be remembered that not all renderers will be able to fully
represent strokes as set out by this interface.
ImageOutline specifies how individual source rasters in a multi-raster set
(such as a set of satellite-image scenes) should be outlined to make the
individual-image locations visible.
<xsd:element name="ImageOutline">
<xsd:annotation>
<xsd:documentation> "ImageOutline" specifies
how individual source rasters in a multi-raster set
(such as a set of satellite-image scenes) should be
outlined to make the individual-image locations visible.
<xsd:element name="LabelPlacement">
<xsd:annotation>
<xsd:documentation>
The "LabelPlacement" specifies where and how a text label should
be rendered relative to a geometry.
LayerFeatureConstraints define what features and feature types are referenced
in a layer.
<xsd:element name="LayerFeatureConstraints">
<xsd:annotation>
<xsd:documentation> LayerFeatureConstraints define what
features & feature types are referenced in a
layer.
A symbolizer describes how a feature should appear on a map.
The symbolizer describes not just the shape that should appear but also
such graphical properties as color and opacity.
A symbolizer is obtained by specifying one of a small number of different
types of symbolizer and then supplying parameters to override its default
behaviour.
<xsd:element name="LineSymbolizer" substitutionGroup="sld:Symbolizer">
<xsd:annotation>
<xsd:documentation>
A LineSymbolizer is used to render a "stroke" along a linear geometry.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="sld:SymbolizerType">
<xsd:sequence>
<xsd:element ref="sld:Geometry" minOccurs="0"/>
<xsd:element ref="sld:Stroke" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
Renderers can use this information when displaying styled features, though
it must be remembered that not all renderers will be able to fully
represent strokes as set out by this interface.
<xsd:element name="Mark">
<xsd:annotation>
<xsd:documentation>
A "Mark" specifies a geometric shape and applies coloring to it.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="sld:WellKnownName" minOccurs="0"/>
<xsd:element ref="sld:Fill" minOccurs="0"/>
<xsd:element ref="sld:Stroke" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Renderers can use this information when displaying styled features, though
it must be remembered that not all renderers will be able to fully
represent strokes as set out by this interface.
OverlapBehavior tells a system how to behave when multiple raster images in
a layer overlap each other, for example with satellite-image scenes.
<xsd:element name="OverlapBehavior">
<xsd:annotation>
<xsd:documentation> "OverlapBehavior" tells a
system how to behave when multiple raster images in
a layer overlap each other, for example with
satellite-image scenes.
A symbolizer describes how a feature should appear on a map.
The symbolizer defines not just the shape that should appear but also such
graphical properties as color and opacity.
A symbolizer is obtained by specifying one of a small number of different
types of symbolizer and then supplying parameters to overide its default
behaviour.
<xsd:element name="PointSymbolizer" substitutionGroup="sld:Symbolizer">
<xsd:annotation>
<xsd:documentation>
A "PointSymbolizer" specifies the rendering of a "graphic symbol"
at a point.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="sld:SymbolizerType">
<xsd:sequence>
<xsd:element ref="sld:Geometry" minOccurs="0"/>
<xsd:element ref="sld:Graphic" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
Renderers can use this information when displaying styled features, though
it must be remembered that not all renderers will be able to fully
represent strokes as set out by this interface.
A symbolizer describes how a polygon feature should appear on a map.
The symbolizer describes not just the shape that should appear but also
such graphical properties as color and opacity.
A symbolizer is obtained by specifying one of a small number of different
types of symbolizer and then supplying parameters to overide its default
behaviour.
<xsd:element name="PolygonSymbolizer" substitutionGroup="sld:Symbolizer">
<xsd:annotation>
<xsd:documentation>
A "PolygonSymbolizer" specifies the rendering of a polygon or
area geometry, including its interior fill and border stroke.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="sld:SymbolizerType">
<xsd:sequence>
<xsd:element ref="sld:Geometry" minOccurs="0"/>
<xsd:element ref="sld:Fill" minOccurs="0"/>
<xsd:element ref="sld:Stroke" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
Renderers can use this information when displaying styled features, though
it must be remembered that not all renderers will be able to fully
represent strokes as set out by this interface.
The Stroke object encapsulates the graphical-symbolization parameters for
linear geometries.
There are three basic types of stroke: solid color, graphic fill (stipple),
and repeated linear graphic stroke.
A repeated linear graphic is plotted linearly and has its graphic symbol
bent around the curves of the line string.
Indicates how geographical content should be displayed (we call this a style for simplicity; in the spec it is called a UserStyle (user-defined style)).
A simple visitor whose purpose is to extract the set of attributes used by a
Style, that is, those that the Style expects to find in order to work
properly
This is very similiar to StyleAttributeExtractor, but with these differences:
a) it doesnt the count the tag in the
b) it doesnt count anything in the 's tag
c) it doesnt count anything in the 's
A symbolizer describes how a feature should appear on a map.
A symbolizer is obtained by specifying one of a small number of different
types of symbolizer and then supplying parameters to override its default
behaviour.
The text symbolizer describes how to display text labels and the like.
<xsd:element name="TextSymbolizer" substitutionGroup="sld:Symbolizer">
<xsd:annotation>
<xsd:documentation>
A "TextSymbolizer" is used to render text labels according to
various graphical parameters.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="sld:SymbolizerType">
<xsd:sequence>
<xsd:element ref="sld:Geometry" minOccurs="0"/>
<xsd:element ref="sld:Label" minOccurs="0"/>
<xsd:element ref="sld:Font" minOccurs="0"/>
<xsd:element ref="sld:LabelPlacement" minOccurs="0"/>
<xsd:element ref="sld:Halo" minOccurs="0"/>
<xsd:element ref="sld:Fill" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
Renderers can use this information when displaying styled features, though
it must be remembered that not all renderers will be able to fully
represent strokes as set out by this interface.
DJB: on inlinefeature support:
The inline features also lets you "sort of" make your WMS into a WFS-T.
I was going to implement this after SLD POST on monday, but I was
expecting the definition in the spec to be a bit "nicer".