Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have several floating point raster files where nodata values are signified by NaNs. I would like to mask these values as transparent using an SDL style before uploading to GeoServer. However, when I attempt to use the snippet:

<StyledLayerDescriptor version="1.0.0" 
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
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">
<NamedLayer>
<Name>Transparent NaNs</Name>
<UserStyle>
  <Title>Transparent NaNs</Title>
  <FeatureTypeStyle>
    <Rule>
      <RasterSymbolizer>
        <ColorMap>
          <!-- Set NaNs to transparent.  Fails! -->
          <ColorMapEntry color="#000000" opacity="0" quantity="NaN" />
          <ColorMapEntry color="#FF0000" quantity="-1.72563123703" opacity="1" />
          <ColorMapEntry color="#0000FF" quantity="1.4878716468811" opacity="1" />
        </ColorMap>
      </RasterSymbolizer>
    </Rule>
  </FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

I get a pink rectangle where the raster should display. Substituting -9999 for NaN works, but I'd like to find a more appropriate way to just target NaNs. Ideally, I would also prefer not changing the underlying raster or needing to generate a new one, i.e. replacing the NaNs with some large floating point value.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.