0

While using GeoTiffReader provided by Geotools library I am facing disk space issue, the geoTiffReader tries to cache the image at /private/var/folders location locally. It doesn't clears this memory once the processing is completed. I tried to do it manually using below code but of no use

if(null != geoTiffReader){
                geoTiffReader.dispose();
            }

When I debugged the dispose method in GeoTiffReader found the below code where closeMe is always false for an InputStream.

public void dispose() {
        if (inStream != null && closeMe) {
            try {
                inStream.close();
            } catch (IOException e) {
                if (LOGGER.isLoggable(Level.FINE))
                    LOGGER.log(Level.FINE, e.getLocalizedMessage(), e);
            }
        }
    }

Can anyone suggest how to clear this cache?

  • It seems to depend on how you construct the reader - can you add that code – Ian Turton Jul 30 at 10:45
  • I initialise the reader using this code GeoTiffReader geoTiffReader = new GeoTiffReader(s3Object.getObjectContent()); – Pramod91 Jul 30 at 10:50
  • can you use the edit button and say what s3Object.getObjectContent() gives. You might want to use the gt-s3-geotiff reader too – Ian Turton Jul 30 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.