I have downloaded around 300 GeoTIFF images of totally 60 Gb. Together they make up a layer which I would like to serve as a WMS on my GeoServer. The images show where there are likely to be water. Where there are "no" water image is transparent.

enter image description here

I'm not sure where to go from here.

I read about how to compress and turn file into Tiles here: GeoTiff size - what to do?

When I run the command gdal_translate -co "TILED=YES" -co "COMPRESS=JPEG" input_filename.tiff output_filename.tiff

I get an error saying: "ERROR 1: JPEGSetupEncode:BitsPerSample 16 not allowed for JPEG"

I assume it won't work to keep the transparency with JPEG, so compression should be done in another way. I tried to change the command to "COMPRESS=PNG" but it didn't recognize it.

Next challenge I have is that I don't know much about WMS. Previously, I have uploaded one big geotiff on Geoserver and made it into a WMS, but I assume that using tiles is the way to go with very big layers?

Basically, I don't know much really. I have my 300 files and I need to turn them into a reasonable WMS. Any thoughts about the process or perhaps can point me in the right direction?

I use Leaflet to display my maps and layers.


This is the info when I run gdalinfo on the original file:

Driver: GTiff/GeoTIFF
Files: MF_64_4_2575.tif
Size is 12500, 12500
Coordinate System is:
Origin = (475000.000000000000000,6450000.000000000000000)
Pixel Size = (2.000000000000000,-2.000000000000000)
Image Structure Metadata:
Corner Coordinates:
Upper Left  (  475000.000, 6450000.000) ( 14d34'29.25"E, 58d11'25.86"N)
Lower Left  (  475000.000, 6425000.000) ( 14d34'38.83"E, 57d57'57.50"N)
Upper Right (  500000.000, 6450000.000) ( 15d 0' 0.00"E, 58d11'28.41"N)
Lower Right (  500000.000, 6425000.000) ( 15d 0' 0.00"E, 57d58' 0.03"N)
Center      (  487500.000, 6437500.000) ( 14d47'17.02"E, 58d 4'43.59"N)
Band 1 Block=512x512 Type=Int16, ColorInterp=Gray
  Min=0.000 Max=4356.000 
  Minimum=0.000, Maximum=4356.000, Mean=294.284, StdDev=337.062
  NoData Value=-1
  Overviews: 6250x6250, 3125x3125, 1563x1563, 782x782, 391x391, 196x196

I have tried compress it with LZW this way:

gdal_translate MF_64_4_2575.tif lzw_test3_tiled.tif -mask 1 -co COMPRESS=LZW -co "TILED=YES"

The result is however not a smaller file, but slightly bigger. This is also the conclusion here: https://havecamerawilltravel.com/photographer/tiff-image-compression/

So, next in line would be to convert it from 16 bit to 8 bit. I found and tried this:

gdal_translate -of GTiff -ot Byte -scale 0 65535 0 255 MF_64_4_2575.tif 8bit_test.tif

Although the file size was reduced to 156 mb instead of 240 mb it didn't kept it transparent where it originally was, and also it seems like it inverted the data and now had data where it should be transparent.

I also tried to add --config GDAL_TIFF_INTERNAL_MASK YES but that didn't kept the transparency either.

I am out of ideas on how to go from my +300 geotiffs (60Gb) to a reasonable sized WMS served on GeoServer. If any thoughts, please share.

Image should look like the attached, but doesn't need to contain any other information besides the colors, the mask and having in correctly georeferenced.

  • Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works.
    – Ian Turton
    Apr 16, 2020 at 16:31
  • 1
    You have two questions - one about gdal_translate that the manual will answer and the other about GeoServer which is also answered in the manuall
    – Ian Turton
    Apr 16, 2020 at 16:33
  • Thank you @IanTurton! As I'm fairly uninitiated into the GIS world yet, the manuals are hard to chew. Don't even know really what to look for. However, I have found that compression with LZW only made it bigger and that gdal_translate -of PNG -ot UInt16 -co "WORLDFILE=YES" input_file.tif output_file.png does turn it into .png and also reduces the size of about 50%. Even with 50% reduced size it is still about 30 gb. I have no clue, but it still feels large. Not sure I'm on the right path...
    – agh
    Apr 17, 2020 at 15:17
  • You should probably make a geotiff with compression LZW or drop the 16bit ints and use JPEG - really depends on the type of raster
    – Ian Turton
    Apr 17, 2020 at 15:43
  • @IanTurton, I have tried both of those alternative ways. Please see the updated information in the question. I'm out of ideas, but really need to find a solution. Any other thoughts?
    – agh
    Apr 20, 2020 at 17:04

1 Answer 1


Make a new store with Raster data source ImageMosaic, and Geoserver will serve tiles on the fly from whatever area is requested. There is no need to touch the individual source files, as long as they are georeferenced and placed in the same folder.


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.