[Geoserver-users] Tips on serving Orthophotos as ImageMosaic

Hello list,

I have 20,000 of TIFF+TFW files that I want to serve in GeoServer 2.4.1 as WMS. I have followed the GeoServer on Steroids notes and I did the following:

  1. Added projection using gdal_translate
  2. Added inner-tiles (512 x 512) using gdal_translate
  3. Added overviews (2 4 8 16 32) using gdal_addo
  4. Compressed the dataset with LZW method using gdal_translate
  5. Created one big GeoTIFF file using gdal_merge.py

I have tested the above on a small set of 150 TIFFs and the result was one big GeoTIFF of 10.8 GB size. I have 10,000 TIFFs and this way I will end up with roughly 100 GeoTIFF files having a size of 10GB each which is far more than the original size of all the TIFF files!

I have a couple of questions:

  1. What compression method do you recommend? (I am currently testing with LZW predictor=1, LZW predictor=2, Deflate predictor=1 and Deflate predictor=2).
  2. Are the overviews enough? Do I need to generate more overviews? (e.g 64 128)
  3. What resampling algorithms are most recommended? Where can I read about resampling algorithms?
  4. Any tips or recommendations?

Best regards,
//Ammar

Hi,

Show us
- gdalinfo report of one of the originals
- the nature of images (aerial/satellite images or raster maps)
- the exact gdal commands you have been using

It seems that you are using same kind of work flow that you presented in your question in gdal-dev mailing list and you repeat the same error as well. Gdal_merge does not honour the work you have done in previous steps with tiles, compression and overviews. It creates a new bigtiff file for use and if you use the defaults the result will be uncompressed tiff without inner tiling.

-Jukka Rahkonen-

________________________________
Ammar wrote:

Hello list,

I have 20,000 of TIFF+TFW files that I want to serve in GeoServer 2.4.1 as WMS. I have followed the GeoServer on Steroids<http://elogeo.nottingham.ac.uk/xmlui/bitstream/handle/url/226/gs_steroids_sgiannec_foss4g2013_01.03.pdf?sequence=1&gt; notes and I did the following:

1. Added projection using gdal_translate
2. Added inner-tiles (512 x 512) using gdal_translate
3. Added overviews (2 4 8 16 32) using gdal_addo
4. Compressed the dataset with LZW method using gdal_translate
5. Created one big GeoTIFF file using gdal_merge.py

I have tested the above on a small set of 150 TIFFs and the result was one big GeoTIFF of 10.8 GB size. I have 10,000 TIFFs and this way I will end up with roughly 100 GeoTIFF files having a size of 10GB each which is far more than the original size of all the TIFF files!

I have a couple of questions:

1. What compression method do you recommend? (I am currently testing with LZW predictor=1, LZW predictor=2, Deflate predictor=1 and Deflate predictor=2).
2. Are the overviews enough? Do I need to generate more overviews? (e.g 64 128)
3. What resampling algorithms are most recommended? Where can I read about resampling algorithms?
4.
5. Any tips or recommendations?

Best regards,
//Ammar

Hi Ammar,
I’ve done similar recently so hopefully can help. I’ve got about 3,500 tiles which all form a single GeoTIFF. I used Image Mosiac because the resulting file will be too large, but I doubt that would be the case with you as your outputs are significantly less than 10GB. You should be able to use the normal GeoTIFF driver .

Anyway, I create the following batchfile (Windows) which does everything in a single step:

set THIS_DIR=%1

cd %THIS_DIR%
dir /b /s *.tif > tiff_list.txt
REM Builds a VRT. A VRT is basically just a XML file saying what all the source tif files are.
gdalbuildvrt -srcnodata 255 -vrtnodata 255 -a_srs EPSG:27700 -input_file_list tiff_list.txt %THIS_DIR%.vrt

REM This is what actually does the mosaicing.
gdal_translate -of GTiff -co TILED=YES -co BIGTIFF=YES -co COMPRESS=JPEG -co JPEG_QUALITY=80 -co BLOCKXSIZE=512 -co BLOCKYSIZE=512 -co PHOTOMETRIC=YCBCR %THIS_DIR%.vrt %THIS_DIR%.tif
Echo “Created”

REM Now creating pyramids.
gdaladdo %THIS_DIR%.tif -r average --config COMPRESS_OVERVIEW JPEG --config JPEG_QUALITY_OVERVIEW 60 --config INTERLEAVE_OVERVIEW PIXEL --config PHOTOMETRIC_OVERVIEW YCBCR 2 4 8 16 32 64 128 256 512
Echo “Tiled”
cd …

To run the batch file:

run_me.bat SP02

FOR /D %%G in (“S*”) DO call run_me.bat %%G

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

···

The SP02 is the name of the directory that has all the TIFFs that need to be mosaiced together. The result is super-small (highly compressed JPEG, but no real loss of quality), and optimised for GeoServer.
The output is a file in the directory called “SP02.tif”.
You’ll want to take off a few levels of pyramids, but this will probably work as-is otherwise.
Use this equation to figure out how many levels of pyramids you need:
http://docs.geoserver.org/stable/en/user/tutorials/imagemosaic-jdbc/imagemosaic-jdbc_tutorial.html#how-many-pyramids-are-needed

===

As you need to do this 100 times, I’d suggest splitting up your TIFF’s into different directories (one directory for each output tiff you want), then running a batch file which in turn runs the above batch file 100 times.

That batch file can simply be:

Although running 100 at once may kill your computer. :slight_smile:

====
And on the issue of resampling - if it’s orthophotography I stick with average; it doesn’t make much difference because of the nature of the product. It’s more important when doing thematic maps.

Regards,

Jonathan

On 6 December 2013 10:36, Ammar <ammar83_h@anonymised.com> wrote:

Hello list,

I have 20,000 of TIFF+TFW files that I want to serve in GeoServer 2.4.1 as WMS. I have followed the GeoServer on Steroids notes and I did the following:

  1. Added projection using gdal_translate
  2. Added inner-tiles (512 x 512) using gdal_translate
  3. Added overviews (2 4 8 16 32) using gdal_addo
  4. Compressed the dataset with LZW method using gdal_translate
  5. Created one big GeoTIFF file using gdal_merge.py

I have tested the above on a small set of 150 TIFFs and the result was one big GeoTIFF of 10.8 GB size. I have 10,000 TIFFs and this way I will end up with roughly 100 GeoTIFF files having a size of 10GB each which is far more than the original size of all the TIFF files!

I have a couple of questions:

  1. What compression method do you recommend? (I am currently testing with LZW predictor=1, LZW predictor=2, Deflate predictor=1 and Deflate predictor=2).
  2. Are the overviews enough? Do I need to generate more overviews? (e.g 64 128)
  3. What resampling algorithms are most recommended? Where can I read about resampling algorithms?
  4. Any tips or recommendations?

Best regards,
//Ammar


Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


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

Hi again Jukka,

  • gdalinfo report of one of the originals

See the attached .txt file

  • the nature of images (aerial/satellite images or raster maps)

Aerial images.

  • the exact gdal commands you have been using

gdal_translate -a_srs “EPSG:3011” in.tif out.tif

gdal_translate -co compress=deflate -co predictor=1 -co “TILED=YES” -co “BLOCKXSIZE=512” -co “BLOCKYSIZE=512” in.tif out.tif

gdaladdo -r average file.tif 2 4 8 16 32

gdal_merge.py -v -o mosaic.tif -of GTiff --optfile tiff_list.txt

Thank you for your help.

Regards,
Ammar


From: Rahkonen Jukka jukka.rahkonen@anonymised.com
To:geoserver-users@lists.sourceforge.netgeoserver-users@lists.sourceforge.net
Sent: Friday, December 6, 2013 2:04 PM
Subject: Re: [Geoserver-users] Tips on serving Orthophotos as ImageMosaic

Hi,

Show us

  • gdalinfo report of one of the originals
  • the nature of images (aerial/satellite images or raster maps)
  • the exact gdal commands you have been using

It seems that you are using same kind of work flow that you presented in your question in gdal-dev mailing list and you repeat the same error as well. Gdal_merge does not honour the work you have done in previous steps with tiles, compression and overviews. It creates a new bigtiff file for use and if you use the defaults the result will be uncompressed tiff without inner tiling.

-Jukka Rahkonen-


Ammar wrote:

Hello list,

I have 20,000 of TIFF+TFW files that I want to serve in GeoServer 2.4.1 as WMS. I have followed the GeoServer on Steroids<http://elogeo.nottingham.ac.uk/xmlui/bitstream/handle/url/226/gs_steroids_sgiannec_foss4g2013_01.03.pdf?sequence=1> notes and I did the following:

  1. Added projection using gdal_translate
  2. Added inner-tiles (512 x 512) using gdal_translate
  3. Added overviews (2 4 8 16 32) using gdal_addo
  4. Compressed the dataset with LZW method using gdal_translate
  5. Created one big GeoTIFF file using gdal_merge.py

I have tested the above on a small set of 150 TIFFs and the result was one big GeoTIFF of 10.8 GB size. I have 10,000 TIFFs and this way I will end up with roughly 100 GeoTIFF files having a size of 10GB each which is far more than the original size of all the TIFF files!

I have a couple of questions:

  1. What compression method do you recommend? (I am currently testing with LZW predictor=1, LZW predictor=2, Deflate predictor=1 and Deflate predictor=2).
  2. Are the overviews enough? Do I need to generate more overviews? (e.g 64 128)
  3. What resampling algorithms are most recommended? Where can I read about resampling algorithms?
  4. Any tips or recommendations?

Best regards,
//Ammar


Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


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

gdalinfo_output.txt (772 Bytes)

Hi Ammar,

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

···

No problem.

  1. 20 Separate GeoTIFFs that you then mosaic together with ImageMosaic is the preferred way to do things. A single GeoTiff of 30GB would probably be too large. Be sure to use the same GDAL creation code for each of them or ImageMosaic won’t necessarily be able to glue them together.

  2. I believe so, though others on this list will actually know how to. I’ve heard something about Jmeter - https://jmeter.apache.org/ but haven’t used it myself yet.

Regards,

Jonathan

On 16 December 2013 12:36, Ammar <ammar83_h@anonymised.com…> wrote:

Jonathan,

Thank you very much for your reply. I have tested with JPEG compression, as you have suggested, and the output that I got was very small compared to LZW and DEFLATE.

I have a couple of questions, if you don’t mind:

  1. I am thinking of creating 20 GeoTIFF files (each file is the result of merging 500 GeoTiffs) to cover the entire area. My idea is to have 20 Images of 1.5 GB each better than having one huge image of 30 GB and then having Image Mosaic Pluging to create a mosaic of those 20 images. What do you think of this approach? Any ideas or recommendations?

  2. Is there anyway to do benchmarking on GeoServer to compare between WMS as one huge file compares to WMS as Mosaic of 20 files?

Thank you very much

Best regards,
Ammar


From: Jonathan Moules <jonathanmoules@anonymised.com>
To: Ammar <ammar83_h@anonymised.com>
Cc:geoserver-users@anonymised.comts.sourceforge.net” <geoserver-users@lists.sourceforge.net>
Sent: Friday, December 6, 2013 2:34 PM

Subject: Re: [Geoserver-users] Tips on serving Orthophotos as ImageMosaic

Hi Ammar,
I’ve done similar recently so hopefully can help. I’ve got about 3,500 tiles which all form a single GeoTIFF. I used Image Mosiac because the resulting file will be too large, but I doubt that would be the case with you as your outputs are significantly less than 10GB. You should be able to use the normal GeoTIFF driver .

Anyway, I create the following batchfile (Windows) which does everything in a single step:

set THIS_DIR=%1

cd %THIS_DIR%
dir /b /s *.tif > tiff_list.txt
REM Builds a VRT. A VRT is basically just a XML file saying what all the source tif files are.
gdalbuildvrt -srcnodata 255 -vrtnodata 255 -a_srs EPSG:27700 -input_file_list tiff_list.txt %THIS_DIR%.vrt

REM This is what actually does the mosaicing.
gdal_translate -of GTiff -co TILED=YES -co BIGTIFF=YES -co COMPRESS=JPEG -co JPEG_QUALITY=80 -co BLOCKXSIZE=512 -co BLOCKYSIZE=512 -co PHOTOMETRIC=YCBCR %THIS_DIR%.vrt %THIS_DIR%.tif
Echo “Created”

REM Now creating pyramids.
gdaladdo %THIS_DIR%.tif -r average --config COMPRESS_OVERVIEW JPEG --config JPEG_QUALITY_OVERVIEW 60 --config INTERLEAVE_OVERVIEW PIXEL --config PHOTOMETRIC_OVERVIEW YCBCR 2 4 8 16 32 64 128 256 512
Echo “Tiled”
cd …

To run the batch file:

run_me.bat SP02

The SP02 is the name of the directory that has all the TIFFs that need to be mosaiced together. The result is super-small (highly compressed JPEG, but no real loss of quality), and optimised for GeoServer.
The output is a file in the directory called “SP02.tif”.
You’ll want to take off a few levels of pyramids, but this will probably work as-is otherwise.
Use this equation to figure out how many levels of pyramids you need:
http://docs.geoserver.org/stable/en/user/tutorials/imagemosaic-jdbc/imagemosaic-jdbc_tutorial.html#how-many-pyramids-are-needed

===

As you need to do this 100 times, I’d suggest splitting up your TIFF’s into different directories (one directory for each output tiff you want), then running a batch file which in turn runs the above batch file 100 times.

That batch file can simply be:

FOR /D %%G in (“S*”) DO call run_me.bat %%G

Although running 100 at once may kill your computer. :slight_smile:

====
And on the issue of resampling - if it’s orthophotography I stick with average; it doesn’t make much difference because of the nature of the product. It’s more important when doing thematic maps.

Regards,

Jonathan

On 6 December 2013 10:36, Ammar <ammar83_h@anonymised.com> wrote:

Hello list,

I have 20,000 of TIFF+TFW files that I want to serve in GeoServer 2.4.1 as WMS. I have followed the GeoServer on Steroids notes and I did the following:

  1. Added projection using gdal_translate
  2. Added inner-tiles (512 x 512) using gdal_translate
  3. Added overviews (2 4 8 16 32) using gdal_addo
  4. Compressed the dataset with LZW method using gdal_translate
  5. Created one big GeoTIFF file using gdal_merge.py

I have tested the above on a small set of 150 TIFFs and the result was one big GeoTIFF of 10.8 GB size. I have 10,000 TIFFs and this way I will end up with roughly 100 GeoTIFF files having a size of 10GB each which is far more than the original size of all the TIFF files!

I have a couple of questions:

  1. What compression method do you recommend? (I am currently testing with LZW predictor=1, LZW predictor=2, Deflate predictor=1 and Deflate predictor=2).
  2. Are the overviews enough? Do I need to generate more overviews? (e.g 64 128)
  3. What resampling algorithms are most recommended? Where can I read about resampling algorithms?
  4. Any tips or recommendations?

Best regards,
//Ammar


Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


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

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.