I have a script that download and process satellite images using pyhon/gdal and then upload them to GeoServer.

The basic process is:

gdalbuildvrt tmp.vrt file_1.tif file_2.tif ... file_n.tif
gdal_translate -of GTiff -co TILED=YES tmp.vrt outfile.tif
gdaladdo -r gauss outfile.tif 2 4 8 16 32

#then upload to geoserver

outfile.tif looks like this in QGIS: enter image description here

When GeoServer feeds image tiles to my OpenLayers application I am to understand that it applies a contrast enhancement. This is initially a good thing since my images tend to be a little dark.

The problem is that the effect seems to be applied locally on each tile. This is how the same file looks like in OpenLayers: enter image description here

I have tried to modify the used style file (SLD) in GeoServer. Changing the ContrastEnhancement property from Normalize to Histogram makes the effect even bigger.

How do I remove these "boxes" in the image?

Does someone have any ideas for what I could try?


1 Answer 1


Either ask for a WMS layer instead of tiles though the brightness will still change as you zoom or pan across the map. Or specify a fixed color ramp in your SLD.

  • Thank you, using fixed color ramp seems to work. Do you have any tips for what quantity/color values that will give the best result or should I just try different combinations? Something like color="#000000" quantity="-100", color="#111111" quantity="0", color="#222222" quantity="100", etc... ?
    – PederBG
    Jan 10, 2019 at 13:34
  • 1
    I usually use QGis or gdalinfo to tell me ranges and provide color ramps
    – Ian Turton
    Jan 10, 2019 at 13:41
  • In both the image in QGIS and OpenLayers there are different contrasts between the original images making up the mosaic. Is it possible to do anything against this as well? Maybe with GDAL before uploading?
    – PederBG
    Jan 10, 2019 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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