[mapserver-users] SLD with colour ramp in WMS GetMap

Frank Warmerdam warmerdam at pobox.com
Fri Feb 15 11:37:12 PST 2013


Luis,

I suspect the problem is how raster values are scaled.  I think the raster
SLD is applied essentially as a set of classes on the layer but it is not
clear how scaling gets set.  What does the layer definition look like?  Can
you try doing what you want with mapserver classes in the map file?

While your SLD looks fine, how these are used by mapserver is fiddly.

Best regards,
Frank
 On Feb 15, 2013 2:55 AM, "Luís de Sousa" <luis.a.de.sousa at gmail.com> wrote:

> Hello everyone,
>
> I have a raster layer with the following range of values:
>
> $ gdalinfo -hist my_data.tiff
> [...]
>     STATISTICS_MAXIMUM=128.30499267578
>     STATISTICS_MEAN=6.3870258293789
>     STATISTICS_MINIMUM=-9.5671482086182
>     STATISTICS_STDDEV=11.960967394892
>
> This is layer is being published through Mapserver and I get perfectly
> correct maps through WMS.
>
> Now I'd like to style the maps retrieved by mapserver using the SLD
> parameter of the GetMap request. I'm starting with the basic example in the
> SLD Cookbook [1]:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <StyledLayerDescriptor version="1.0.0"
>   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">
>   <NamedLayer>
>     <Name>my_data</Name>
>      <UserStyle>
>       <Title>SLD Cook Book: Two color gradient</Title>
>       <FeatureTypeStyle>
>         <Rule>
>           <RasterSymbolizer>
>             <ColorMap>
>               <ColorMapEntry color="#008000" quantity="-10" />
>               <ColorMapEntry color="#663333" quantity="130" />
>             </ColorMap>
>           </RasterSymbolizer>
>         </Rule>
>       </FeatureTypeStyle>
>     </UserStyle>
>   </NamedLayer>
> </StyledLayerDescriptor>
>
> When I issue a request with this SLD file:
>
>
> http://my.server/cgi-bin/mapserv?map=/var/www/file.map&VERSION=1.1.1&REQUEST=GetMap&LAYERS=my_data&SRS=EPSG:3857&BBOX=497600,6784100,498900,6786500&WIDTH=300&HEIGHT=600&FORMAT=image/gif&SLD=http://my.server/SLD/my_data.sld
>
> I'm getting back simply a green patch (see the file my_data_SLD.gif).
> Whereas without the SLD argument the features in the file are quite visible
> (my_data.gif).
>
> <http://osgeo-org.1560.n6.nabble.com/file/n5034507/my_data_SLD.gif>
>
> <http://osgeo-org.1560.n6.nabble.com/file/n5034507/my_data.gif>
>
> So what's wrong in here? The SLD file is exactly the same found in the SLD
> cookbock, I doubt it has an error. Do I have to configure the layer somehow
> in the map file in order for Mapserver to style it with the SLD?
>
> Thank you.
>
> [1]
>
> http://docs.geoserver.org/latest/en/user/styling/sld-cookbook/rasters.html#example-raster
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/SLD-with-colour-ramp-in-WMS-GetMap-tp5034507.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130215/97241e1e/attachment-0001.html>


More information about the mapserver-users mailing list