[Geoserver-users] RasterSymbolizer no-data pixels

Hi there.

i tried to use the colorMap tags to give transparency in the nodata pixels:

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd&quot;&gt;
  <NamedLayer>
    <Name>raster</Name>
    <UserStyle>
      <Name>raster</Name>
      <Title>Raster</Title>
      <Abstract>A sample style for rasters, good for displaying
imagery</Abstract>
      <FeatureTypeStyle>
        <FeatureTypeName>Feature</FeatureTypeName>
        <Rule>
         <RasterSymbolizer>
<ColorMap type="ramp" extended="true">
      <ColorMapEntry color="#000000" quantity="0.0" opacity="1.0"/>
      <ColorMapEntry color="#737373" quantity="2.0" opacity="1.0"/>
      <ColorMapEntry color="#666666" quantity="10.0" opacity="1.0"/>
      <ColorMapEntry color="#595959" quantity="15.0" opacity="1.0"/>
      <ColorMapEntry color="#4d4d4d" quantity="20.0" opacity="1.0"/>
      <ColorMapEntry color="#404040" quantity="25.0" opacity="1.0"/>
      <ColorMapEntry color="#333333" quantity="30.0" opacity="1.0"/>
      <ColorMapEntry color="#ffffff" quantity="100.0" opacity="1.0"/>
     </ColorMap>
        <Opacity>1.0</Opacity>
     <ChannelSelection>
      <GrayChannel>
       <SourceChannelName>1</SourceChannelName>
        <ContrastEnhancement>
         <Normalize/>
        </ContrastEnhancement>
      </GrayChannel>
     </ChannelSelection>
     <ContrastEnhancement>
      <GammaValue>1</GammaValue>
            </ContrastEnhancement>

          </RasterSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

and the result was:

Now, the background color is perfect.

But, now the images are with very low quality.

Zoom in
Original:

Geoserver raster:

As you can see, with the "<ColorMap>" the nodata pixels disappear, but
pictures are affected.

I wounder how can it be done without quality image defect. The idea is to
maintain the image original quality.

Cumps,

D.Nunes
--
View this message in context: http://www.nabble.com/RasterSymbolizer-no-data-pixels-tp21125883p21125883.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Ciao Nunes,
sorry for the late answer.
I have checked again the whole thread about the nodata issue.
In order to help you I'd need to have a bettere idea about the
structure of your data. At a minimum, I'd like to see the output of a
gdalinfo on 1 or 2 of your images.
Best thing would be being provided with 2-3 sample images.

Simone.
-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Owner - Software Engineer
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928

http://www.geo-solutions.it
http://simboss.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini

-------------------------------------------------------

On Mon, Dec 22, 2008 at 11:52 AM, D.Nunes <dinisnunes1@anonymised.com> wrote:

Hi there.

i tried to use the colorMap tags to give transparency in the nodata pixels:

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd&quot;&gt;
<NamedLayer>
   <Name>raster</Name>
   <UserStyle>
     <Name>raster</Name>
     <Title>Raster</Title>
     <Abstract>A sample style for rasters, good for displaying
imagery</Abstract>
     <FeatureTypeStyle>
       <FeatureTypeName>Feature</FeatureTypeName>
       <Rule>
        <RasterSymbolizer>
<ColorMap type="ramp" extended="true">
     <ColorMapEntry color="#000000" quantity="0.0" opacity="1.0"/>
     <ColorMapEntry color="#737373" quantity="2.0" opacity="1.0"/>
     <ColorMapEntry color="#666666" quantity="10.0" opacity="1.0"/>
     <ColorMapEntry color="#595959" quantity="15.0" opacity="1.0"/>
     <ColorMapEntry color="#4d4d4d" quantity="20.0" opacity="1.0"/>
     <ColorMapEntry color="#404040" quantity="25.0" opacity="1.0"/>
     <ColorMapEntry color="#333333" quantity="30.0" opacity="1.0"/>
     <ColorMapEntry color="#ffffff" quantity="100.0" opacity="1.0"/>
    </ColorMap>
       <Opacity>1.0</Opacity>
    <ChannelSelection>
     <GrayChannel>
      <SourceChannelName>1</SourceChannelName>
       <ContrastEnhancement>
        <Normalize/>
       </ContrastEnhancement>
     </GrayChannel>
    </ChannelSelection>
    <ContrastEnhancement>
     <GammaValue>1</GammaValue>
           </ContrastEnhancement>

         </RasterSymbolizer>
       </Rule>
     </FeatureTypeStyle>
   </UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

and the result was:

Now, the background color is perfect.

But, now the images are with very low quality.

Zoom in
Original:

Geoserver raster:

As you can see, with the "<ColorMap>" the nodata pixels disappear, but
pictures are affected.

I wounder how can it be done without quality image defect. The idea is to
maintain the image original quality.

Cumps,

D.Nunes
--
View this message in context: http://www.nabble.com/RasterSymbolizer-no-data-pixels-tp21125883p21125883.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi there, thanks for the help.

Gdalinfo 1:
Driver: JPEG/JPEG JFIF
Files: M15.jpg
Size is 3061, 4001
Coordinate System is `'
Origin = (396998.750000000000000,3330001.250000000000000)
Pixel Size = (2.500000000000000,-2.500000000000000)
Corner Coordinates:
Upper Left ( 396998.750, 3330001.250)
Lower Left ( 396998.750, 3319998.750)
Upper Right ( 404651.250, 3330001.250)
Lower Right ( 404651.250, 3319998.750)
Center ( 400825.000, 3325000.000)
Band 1 Block=3061x1 Type=Byte, ColorInterp=Gray
  Image Structure Metadata:
    COMPRESSION=JPEG

Gdalinfo 2:
Driver: JPEG/JPEG JFIF
Files: M16.jpg
Size is 3061, 4001
Coordinate System is `'
Origin = (413348.750000000000000,3340001.250000000000000)
Pixel Size = (2.500000000000000,-2.500000000000000)
Corner Coordinates:
Upper Left ( 413348.750, 3340001.250)
Lower Left ( 413348.750, 3329998.750)
Upper Right ( 421001.250, 3340001.250)
Lower Right ( 421001.250, 3329998.750)
Center ( 417175.000, 3335000.000)
Band 1 Block=3061x1 Type=Byte, ColorInterp=Gray
  Image Structure Metadata:
    COMPRESSION=JPEG

Later I'll send you the sample images.

D.Nunes

Ciao Nunes,
sorry for the late answer.
I have checked again the whole thread about the nodata issue.
In order to help you I'd need to have a bettere idea about the
structure of your data. At a minimum, I'd like to see the output of a
gdalinfo on 1 or 2 of your images.
Best thing would be being provided with 2-3 sample images.

Simone.
-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Owner - Software Engineer
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928

http://www.geo-solutions.it
http://simboss.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini

-------------------------------------------------------

--
View this message in context: http://www.nabble.com/RasterSymbolizer-no-data-pixels-problem-tp21125883p21142271.html
Sent from the GeoServer - User mailing list archive at Nabble.com.