|
Collaborative ALM Free SaaS for open source projects on Amazon EC2 |
|
|
|
|
| Tags: No tags associated yet. |
|
All Tags... |
The best so far, from U of Minn Map Server: http://mapserver.gis.umn.edu/docs/howto/sldhowto
Lots of SLD samples: http://maps.massgis.state.ma.us/geoserver_sld/
Symbolizer overview for Geotools:
http://docs.codehaus.org/display/GEOTDOC/07+Symbolizers
GeoTools documentation for SLD: http://docs.codehaus.org/display/GEOTDOC/06+Style+Layer+Descriptor+Document
GeoTools API for SLD:
http://udig.refractions.net/files/docs/api-geotools/org/geotools/styling/SLDParser.html
from geoserver.org (might be interesting to compare w/GeoTools):
http://geoserver.org/display/GEOSDOC/SLD+Snippets
ESRI:
http://webhelp.esri.com/arcims/9.2/general/mergedProjects/wms_connect/sld/styledlyrdescsupport.htm
Apparently GeoServer has an SLDValidation class that can run through Xerces for validation.
Apache has a text generator, called Texen
, that may be useful to us for developing SLD text.
We should be aware of OGC's Web Map Context (WMC), also referred to as a View Context. This specification gives yet another XML format for defining a configured view of a set of data. SLD provides a way to symbolize one or more data sets, but WMC (as I understand so far) goes further to define the specification of a collection of data sets from (potentially) different sources in a way that's portable, platform-independent format for storage in a repository or for transmission between clients. It's analogous to an "mxd" file from ArcGIS, in that it is the user-configured view of all the spatial data. SLD content can be specified via an external SLD file (referred to w/the WMC <SLD> tag) or given within the WMC document (w/the WMC <StyledLayerDescriptor> tag). The XML document is supposed to have a "*.ccml" suffix.
Also, taken from p. 10 of OGC spec on this
:
A Context document includes information about the server(s) providing layer(s) in the overall map, the bounding box and map projection shared by all the maps, sufficient operational metadata for Client software to reproduce the map, and ancillary metadata used to annotate or describe the maps and their provenance for the benefit of human viewers.
There are several possible uses for Context documents:
Doesn't look like there is a ton of development on this yet. Googling "ccml 'web map context' example" didn't yield anything worthwhile. Annex B of the OGC spec document above has an example.
Note: I fail to specify the namespace/domains for these tags. Some come from OGC GML, or WMS, and some come from SLD. I don't think there is any polymorphism of the same tag across domains, so it probably doesn't matter (somebody check me on this, please). The following document has relatively rigorous specification of the domain: http://maps.massgis.state.ma.us/geoserver_sld/GISDATA.ASSESSPAR_POLY_PUBLIC/WMS/GetMap-GISDATA.ASSESSPAR_POLY_PUBLIC--Default.xml
Specifying a scale for a presentation effect:
<UserStyle>
<FeatureTypeStyle>
<Rule>
<MinScaleDenominator>0</MinScaleDenominator>
<MaxScaleDenominator>30000</MaxScaleDenominator>
</Rule>
</FeatureTypeStyle>
</UserStyle>
Specifying a range of values:
<Filter>
<And>
<PropertyIsGreaterThanOrEqualTo>
<PropertyName>ACRES</PropertyName>
<Literal>0.2</Literal>
</PropertyIsGreaterThanOrEqualTo>
<PropertyIsLessThanOrEqualTo>
<PropertyName>ACRES</PropertyName>
<Literal>0.99</Literal>
</PropertyIsLessThanOrEqualTo>
</And>
</Filter>
<Filter>
<And>
<PropertyIsEqualTo>
<PropertyName>TYPE</PropertyName>
<Literal>HIGH</Literal>
</PropertyIsEqualTo>
<Or>
<PropertyIsEqualTo>
<PropertyName>CODE</PropertyName>
<Literal>2</Literal>
</PropertyIsEqualTo>
<PropertyIsEqualTo>
<PropertyName>CODE</PropertyName>
<Literal>3</Literal>
</PropertyIsEqualTo>
</Or>
</And>
</Filter>
Just using pre-defined stuff:
<Geometry>
<PropertyName>SHAPE</PropertyName>
</Geometry>
<Graphic>
<Mark>
<WellKnownName>CIRCLE</WellKnownName>
<Fill>
<CssParameter name="fill">#FFC6C6</CssParameter>
</Fill>
</Mark>
<Size>5</Size>
</Graphic>
Using images/icons:
<Geometry>
<PropertyName>SHAPE</PropertyName>
</Geometry>
<Graphic>
<Mark>
<ExternalGraphic>
<OnlineResource xlink:href="http://maps.massgis.state.ma.us/images/airport.gif"/>
<Format>image/gif</Format>
</ExternalGraphic>
</Mark>
<Size>5</Size>
</Graphic>
<Stroke>
<CssParameter name="stroke">
<Literal>#0000FF</Literal>
</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
</Stroke>
Note two different syntaxes for specifying a value (either as a <Literal> or as enclosed text).
<CssParameter name="fill">#70d451</CssParameter> <CssParameter name="fill-opacity">0.5</CssParameter>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:href="http://maps.massgis.state.ma.us/images/yellow_green_forward_diagonal_thin.gif"/>
<Format>image/gif</sld:Format>
</ExternalGraphic>
<Size>16</sld:Size>
</Graphic>
</GraphicFill>
</Fill>
<Stroke> <CssParameter name="stroke">#000000</CssParameter> <CssParameter name="stroke-width">1</CssParameter> </Stroke>
Just using pre-defined stuff:
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-size">10</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement>
<Displacement>
<DisplacementX>10</DisplacementX>
<DisplacementY>10</DisplacementY>
</Displacement>
</PointPlacement>
</LabelPlacement>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
Using images/icons:
Note: an example of this approach is given in Link not available [DOC:52963].
Looks like one (painful) way for symbolizing features as a function of a related attribute is to filter each attribute value and associate a specific symbolizer unit. For example, see http://www2.dmsolutions.ca/msapps/world_testdata/tests/sld_tests/sld_line_multi_filter.xml
. From this example, I'm thinking of:
<FeatureTypeStyle>
<Rule>
<Filter>
<PropertyIsEqualTo>
<PropertyName>my_attribute</PropertyName>
<Literal>value1</Literal>
</PropertyIsEqualTo>
</Filter>
<LineSymbolizer>
<Geometry>
<PropertyName>center-line</PropertyName>
</Geometry>
<Stroke>
<CssParameter name="stroke">#0000ff</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
</Stroke>
</LineSymbolizer>
</Filter>
</Rule>
<Rule>...</Rule>
<Rule>...</Rule>
<Rule>...</Rule>
...
</FeatureTypeStyle>
There's also an <ElseFilter/> tag that could be used to render things more efficient. Not entirely clear on how a <Property> is associated with a <Feature>, but I think you are already handling this. Maybe edit this wiki with that info?
I don't really like this approach. I see it getting large (and slow) in a hurry. What do others think?
Here you can use the <ColorMap> tag, which is MUCH more concise:
<ColorMap> <ColorMapEntry color="#00ff00" quantity="22"/> <ColorMapEntry color="#00bf3f" quantity="30"/> <ColorMapEntry color="#007f7f" quantity="37"/> <ColorMapEntry color="#003fbf" quantity="45"/> <ColorMapEntry color="#0000ff" quantity="52"/> <ColorMapEntry color="#000000" quantity="60"/> </ColorMap>
This snippet results in a reclassification of ranges of values one color to a range of values. The ranges created by the example above yield:
class 1: [pixel] >= 22 AND [pixel] < 30 with color 00ff00 class 2: [pixel] >= 30 AND [pixel] < 37 with color 00bf3f class 3: [pixel] >= 37 AND [pixel] < 45 with color 007f7f class 4: [pixel] >= 45 AND [pixel] < 52 with color 003fbf class 5: [pixel] >= 52 AND [pixel] < 60 with color 0000ff class 6: [pixel] = 60 with color 000000
NOTE: THERE IS NO XML OR ACTUAL SYNTAX FOR THE SECOND SNIPPET -- THIS IS JUST WHAT THE WMS SERVER UNDERSTANDS.
Although not clear to me yet, there are differences in the handling of 8-bit vs. 16-bit. rasters.
An example of a visualization of a 16-bit image:
This stuff can get verbose, so maybe we want to invest in developing some kind of SLD-generator. UMinn's Map Server does this (http://mapserver.gis.umn.edu/docs/howto/sldhowto/#php-mapscript-example-that-generates-an-sld-from-a-mapfile
). Something to think about.
There is pretty functionality inside an open-source web-based GIS called MapBuilder that calls itself an "SLD Editor," but this just allows you to fiddle with limited display characteristics of already loaded data. Doesn't really seem to work and the GUI design is not so hot. Seems like an SLD editor (for real, and standalone) would be worth another JavaForge project!
Found a library w/Java API called FreeMarker
. It's for using templates to generate text files (like HTML, XML, Java source, etc). Like Apache Velocity
, although it claims to be better. Not actually tied to servlets or anything like them.
There's a netbeans plugin for FreeMarker available here
. Velocity is currently being built into NetBeans (available in the development build).