4

I have single band DEMs I'm trying to use in an ImageMosaic in GeoServer 2.11.2 that displays a black background color by default. I want that background color to go away and the default color ramping to range of displayed values to occur.

enter image description here

The default behavior is almost exactly what I want - when you zoom in, it scales the colors to the min/max of the dataset currently in view.

enter image description here

All I want to do is hide the background color of -9999.0 so that scaling isn't messed up by the nodata color. However all attempts to fix this don't seem to work.

-Setting InputTransparentColor and OutputTransparentColor cause rendering to fail with an error 'Unsupported data type'.

-Setting an SLD ColorMap that hides -9999.0 values 'works' but you need to then to specify the rest of the color ramp which I don't want to do because it needs to be dynamic. (So I don't want this answer).

-Setting an SLD ContrastEnhancement causes a NullPointerException

<ContrastEnhancement>
  <Normalize />
</ContrastEnhancement>

And trying to set VendorOptions inside the ContrastEnhancement Node doesn't validate.

  • Possible duplicate of Aerial imagery showing in different colour while pan/zoom GeoServer – pLumo Sep 22 '17 at 9:41
  • It isn't a duplicate, but we're both dealing with the ImageMosaic plugin. – WolfOdrade Sep 22 '17 at 23:26
  • Sorry, I must have missed this sentence The default behavior is almost exactly what I want - when you zoom in, it scales the colors to the min/max of the dataset currently in view.. – pLumo Sep 25 '17 at 7:34
  • Do you use JAI-EXT extension? Normal JAI can not handle nodata value. – pLumo Sep 25 '17 at 7:37
  • I don't, but should! Thanks I didn't know about jai-ext before. Unfortunately that didn't solve the problem...but I'm new to jai-ext obviously so do you have a configuration that might work differently or should it work out of the box? But, the behavior I want does exist using a single mosaicked image (loaded without imagemosaic) without any tweaking. – WolfOdrade Sep 27 '17 at 21:32
4
+50

The input/output transparency colors do not work with floating point image mosaics.

The easiest way is probably to add a transparency mask to each of the image, this can be done with GDAL -

gdalwarp -co TILED=YES -co COMPRESS=LZW -srcnondata -9999 -dstnodata -9999 -dstalpha <input image> <output image>

The other options involve creating footprints file or files for the granules in the mosaic, and configuring the behavior of the footprints. See GeoServer Documentation.

Creating the ShapeFile with the actual image footprints can be done with a combination of GDAL tools:

Create a virtual coverage with of the nodata area -

gdal_translate -b mask -of vrt -a_nodata 0 <image file> <image>.vrt

Use polygonize to create polygons that represent the data & nodata regions of the image gdal_polygonize.py -b 1 -8 -q -f gml <image>.vrt <image>.gml footprint DN

Use ogr2ogr to add the data to a shapefile

ogr2ogr -f "ESRI Shapefile" -dialect SQLite -append -sql "select ST_BuildArea(ST_ExteriorRing(geometryProperty)),'<image file>' as location from footprint where DN=255" footprints.shp <image>.gml

-1

try using EQCL filtering in Coverage Parameters (http://docs.geoserver.org/latest/en/user/data/raster/imagemosaic/configuration.html#coverage-parameters)

  • 1
    ECQL filtering does not filter raster values but removes granules dependent on attributes in the index table. – pLumo Sep 22 '17 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.