TransWikia.com

"Optimized" TIFF file render slower than big original in GeoServer?

Geographic Information Systems Asked on December 25, 2021

I struggle to "optimize" my rasters for publication on GeoServer.
My original raw GeoTIFF raster render before my "optimized" and I don’t understand why?

The original file is at 18GB, Float32, size 69674, 67700

The "optimised" was created by

gdal_translate -a_nodata 0 -of GTiff -ot UInt16 -co "COMPRESS=DEFLATE" -co "TILED=YES" in.tif out.tif

It is at 0.56 GB. But despite this the original file is still rendered first, not by much but the "optimization" I have applied seem useless??

gdalinfo original file

Driver: GTiff/GeoTIFF
Files: original.tif
Size is 69674, 67700
Coordinate System is:
PROJCRS["ETRS89 / UTM zone 32N",
    BASEGEOGCRS["ETRS89",
        DATUM["European Terrestrial Reference System 1989",
            ELLIPSOID["GRS 1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4258]],
    CONVERSION["UTM zone 32N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",9,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["unknown"],
        AREA["Europe - 6┬░E to 12┬░E and ETRS89 by country"],
        BBOX[38.76,6,83.92,12]],
    ID["EPSG",25832]]
Data axis to CRS axis mapping: 1,2
Origin = (551670.689999999944121,7038332.250000000000000)
Pixel Size = (0.500009499956943,-0.500009500738550)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  551670.690, 7038332.250) ( 10d 2'12.57"E, 63d28'10.61"N)
Lower Left  (  551670.690, 7004481.607) ( 10d 1'33.45"E, 63d 9'57.09"N)
Upper Right (  586508.352, 7038332.250) ( 10d44' 8.05"E, 63d27'46.25"N)
Lower Right (  586508.352, 7004481.607) ( 10d43' 2.59"E, 63d 9'33.04"N)
Center      (  569089.521, 7021406.928) ( 10d22'44.17"E, 63d18'53.28"N)
Band 1 Block=69674x1 Type=Float32, ColorInterp=Gray

"Optimized"

Driver: GTiff/GeoTIFF
Files: optimized.tif
Size is 69674, 67700
Coordinate System is:
PROJCRS["ETRS89 / UTM zone 32N",
    BASEGEOGCRS["ETRS89",
        DATUM["European Terrestrial Reference System 1989",
            ELLIPSOID["GRS 1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4258]],
    CONVERSION["UTM zone 32N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",9,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["unknown"],
        AREA["Europe - 6┬░E to 12┬░E and ETRS89 by country"],
        BBOX[38.76,6,83.92,12]],
    ID["EPSG",25832]]
Data axis to CRS axis mapping: 1,2
Origin = (551670.689999999944121,7038332.250000000000000)
Pixel Size = (0.500009499956943,-0.500009500738550)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  551670.690, 7038332.250) ( 10d 2'12.57"E, 63d28'10.61"N)
Lower Left  (  551670.690, 7004481.607) ( 10d 1'33.45"E, 63d 9'57.09"N)
Upper Right (  586508.352, 7038332.250) ( 10d44' 8.05"E, 63d27'46.25"N)
Lower Right (  586508.352, 7004481.607) ( 10d43' 2.59"E, 63d 9'33.04"N)
Center      (  569089.521, 7021406.928) ( 10d22'44.17"E, 63d18'53.28"N)
Band 1 Block=256x256 Type=UInt16, ColorInterp=Gray
  NoData Value=0

One Answer

As noted in comments, you likely need to build overviews.

Overviews and inner tiling optimize two different types of access:

  • Having overviews optimizes the most the case when you're trying to look at the the whole raster on a small map, that is, the case where the GIS software needs to produce an output image that's smaller than the original raster. Overviews allow reading a similarly small image, avoiding excess read and expensive downsampling.

  • Just having tiling optimizes the location of a small (tiny!) area out of a large raster, so the exact opposite case, it speeds up viewing the raster then you're looking at it at its native resolution.

The best situation is when you have both, inner tiling for the base level, and overviews that are tiled for lower zoom level access.

Then you have compression in the mix. That is another trade off, it trades less IO for higher CPU usage. Whether that brings a speed up, it's relative to the balance of your hardware. Are you accessing the raster on a slow network disk? Go for compression. You have lots of fast local storage and your CPU is weak? Don't compress. Your real world situation will likely need tests to determine what is the best scenario for you.

Answered by Andrea Aime on December 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP