0

I am trying to process large GeoTIFF images (128 MB) using GeoTIFF reader provided by Geotools library. However the processing time is very high, can anyone suggest how to reduce this time. Normal processing time for this image is 210000 ms, whereas my target is 500 ms.

GdalInfo of the image:

Driver: GTiff/GeoTIFF  
Files: /Users/RGBI-7cm.tif  
Size is 4000, 4000. 
Coordinate System is `'  
Metadata:  
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)  
  TIFFTAG_XRESOLUTION=1  
  TIFFTAG_YRESOLUTION=1  
Image Structure Metadata:  
  INTERLEAVE=PIXEL  
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 4000.0)
Upper Right ( 4000.0,    0.0)
Lower Right ( 4000.0, 4000.0)
Center      ( 2000.0, 2000.0)
Band 1 Block=4000x1 Type=UInt16, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=4000x1 Type=UInt16, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=4000x1 Type=UInt16, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=4000x1 Type=UInt16, ColorInterp=Alpha

Code for processing the image in Java:

S3Object s3Object = awsFetchService.fetchObject(cropImageRequest.getAwsS3Bucket(),cropImageRequest.getPrimaryFilePath());
GeoTiffReader reader = new GeoTiffReader(s3Object.getObjectContent());
GridCoverage2D gridCoverage = reader.read(null);
1

Pulling an uncompressed and untiled geotiff (even a small one like 128Mb) is going to be slow.

You should process the GeoTiff using the advice in GeoServer on Steroids (video) or Paul Ramsey's GeoTiff Compression for Dummies. This will probably make your tiff small enough that the network transport cost doesn't overwhelm your reading time.

  • I don't have any control on the input image, it is provided by a third party entity via AWS S3 bucket. GeoTIFF reader provided by GeoTools takes a long time to process this image. Is there any way to reduce the processing time using geotools? – Pramod91 Jul 5 at 14:14
  • copy it to a local directory and use it from there? – Ian Turton Jul 5 at 14:23
  • compression is not an option for me, as after reading the raster data I have to crop it as per a bounding box – Pramod91 Jul 5 at 14:45
  • can you provide a link to an example image on S3? – Ian Turton Jul 5 at 16:25
  • GdaIInfo of the image is provided, is it not enough? – Pramod91 Jul 8 at 8:40

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.