I am currently working on netcdf data, which have a cool structure that allowes to have several rasters inside a file. What can be done in that case?
Well the sld structure can contain several styles, so it is quite easy to create a style for every resource.
For example the following sld file:
<?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:UserLayer>
<sld:LayerFeatureConstraints>
<sld:FeatureTypeConstraint/>
</sld:LayerFeatureConstraints>
<sld:UserStyle>
<sld:Name>aspect</sld:Name>
<sld:Title/>
<sld:FeatureTypeStyle>
<sld:Name>aspect</sld:Name>
<sld:FeatureTypeName>Feature</sld:FeatureTypeName>
<sld:SemanticTypeIdentifier>SemanticType[ANY]</sld:SemanticTypeIdentifier>
<sld:Rule>
<sld:RasterSymbolizer>
<sld:Geometry>
<ogc:PropertyName>raster</ogc:PropertyName>
</sld:Geometry>
<sld:Opacity>
<ogc:Literal>1.0</ogc:Literal>
</sld:Opacity>
<sld:OverlapBehavior>
<sld:RANDOM/>
</sld:OverlapBehavior>
<sld:ColorMap type="ramp">
<sld:ColorMapEntry color="#000000" opacity="1.0" quantity="0.0"/>
<sld:ColorMapEntry color="#FFFFFF" opacity="1.0" quantity="180.0"/>
<sld:ColorMapEntry color="#FFFFFF" opacity="1.0" quantity="180.0"/>
<sld:ColorMapEntry color="#000000" opacity="1.0" quantity="360.0"/>
</sld:ColorMap>
<sld:ContrastEnhancement/>
<sld:ShadedRelief>
<sld:BrightnessOnly>false</sld:BrightnessOnly>
<sld:ReliefFactor>55</sld:ReliefFactor>
</sld:ShadedRelief>
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
<sld:UserStyle>
<sld:Name>surface_altitude</sld:Name>
<sld:Title/>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:FeatureTypeName>Feature</sld:FeatureTypeName>
<sld:SemanticTypeIdentifier>SemanticType[ANY]</sld:SemanticTypeIdentifier>
<sld:Rule>
<sld:RasterSymbolizer>
<sld:Geometry>
<ogc:PropertyName>raster</ogc:PropertyName>
</sld:Geometry>
<sld:Opacity>
<ogc:Literal>1.0</ogc:Literal>
</sld:Opacity>
<sld:OverlapBehavior>
<sld:RANDOM/>
</sld:OverlapBehavior>
<sld:ColorMap type="ramp">
<sld:ColorMapEntry color="#00BFBF" opacity="1.0" quantity="2012.86"/>
<sld:ColorMapEntry color="#00FF00" opacity="1.0" quantity="2096.901999816894"/>
<sld:ColorMapEntry color="#00FF00" opacity="1.0" quantity="2096.901999816894"/>
<sld:ColorMapEntry color="#FFFF00" opacity="1.0" quantity="2180.9439996337887"/>
<sld:ColorMapEntry color="#FFFF00" opacity="1.0" quantity="2180.9439996337887"/>
<sld:ColorMapEntry color="#FF7F00" opacity="1.0" quantity="2264.986007080078"/>
<sld:ColorMapEntry color="#FF7F00" opacity="1.0" quantity="2264.986007080078"/>
<sld:ColorMapEntry color="#BF7F3F" opacity="1.0" quantity="2349.027999267578"/>
<sld:ColorMapEntry color="#BF7F3F" opacity="1.0" quantity="2349.027999267578"/>
<sld:ColorMapEntry color="#141514" opacity="1.0" quantity="2433.069991455078"/>
</sld:ColorMap>
<sld:ContrastEnhancement/>
<sld:ShadedRelief>
<sld:BrightnessOnly>false</sld:BrightnessOnly>
</sld:ShadedRelief>
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
<sld:UserStyle>
<sld:Name>d8scheme_drainage_directions</sld:Name>
<sld:Title/>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:FeatureTypeName>Feature</sld:FeatureTypeName>
<sld:SemanticTypeIdentifier>SemanticType[ANY]</sld:SemanticTypeIdentifier>
<sld:Rule>
<sld:RasterSymbolizer>
<sld:Geometry>
<ogc:PropertyName>raster</ogc:PropertyName>
</sld:Geometry>
<sld:Opacity>
<ogc:Literal>1.0</ogc:Literal>
</sld:Opacity>
<sld:OverlapBehavior>
<sld:RANDOM/>
</sld:OverlapBehavior>
<sld:ColorMap type="ramp">
<sld:ColorMapEntry color="#FFFF00" opacity="1.0" quantity="1.0"/>
<sld:ColorMapEntry color="#FFFF00" opacity="1.0" quantity="1.0"/>
<sld:ColorMapEntry color="#00FF00" opacity="1.0" quantity="2.0"/>
<sld:ColorMapEntry color="#00FF00" opacity="1.0" quantity="2.0"/>
<sld:ColorMapEntry color="#00FFFF" opacity="1.0" quantity="3.0"/>
<sld:ColorMapEntry color="#00FFFF" opacity="1.0" quantity="3.0"/>
<sld:ColorMapEntry color="#FF00FF" opacity="1.0" quantity="4.0"/>
<sld:ColorMapEntry color="#FF00FF" opacity="1.0" quantity="4.0"/>
<sld:ColorMapEntry color="#0000FF" opacity="1.0" quantity="5.0"/>
<sld:ColorMapEntry color="#0000FF" opacity="1.0" quantity="5.0"/>
<sld:ColorMapEntry color="#A020F0" opacity="1.0" quantity="6.0"/>
<sld:ColorMapEntry color="#A020F0" opacity="1.0" quantity="6.0"/>
<sld:ColorMapEntry color="#FFA500" opacity="1.0" quantity="7.0"/>
<sld:ColorMapEntry color="#FFA500" opacity="1.0" quantity="7.0"/>
<sld:ColorMapEntry color="#1E90FF" opacity="1.0" quantity="8.0"/>
<sld:ColorMapEntry color="#1E90FF" opacity="1.0" quantity="8.0"/>
<sld:ColorMapEntry color="#FF0000" opacity="1.0" quantity="10.0"/>
<sld:ColorMapEntry color="#FF0000" opacity="1.0" quantity="10.0"/>
</sld:ColorMap>
<sld:ContrastEnhancement/>
<sld:ShadedRelief>
<sld:BrightnessOnly>false</sld:BrightnessOnly>
<sld:ReliefFactor>55</sld:ReliefFactor>
</sld:ShadedRelief>
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:UserLayer>
</sld:StyledLayerDescriptor>
gives me the possibility to load from sld file automatically the styles for the layers aspect, d8scheme_drainage_direction and surface_altitude.
The not so friendly thing is that for now to have multiple styles inside the sld file, you have to paste them from the raster style editor. But once done you are fine.
No comments:
Post a Comment