2 votos

Aceleración del renderizado de imágenes GeoTiff

Utilizo la API GeoTools para leer y renderizar un archivo JPEG GeoTiff comprimido:

 AbstractGridFormat format = new GeoTiffFormat();
    format.accepts(rasterFile);
    //this is a bit hacky but does make more geotiffs work
    Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);

   // InputStream stream = new BufferedInputStream(new FileInputStream(rasterFile), 40*1024);

    reader = format.getReader(rasterFile, hints);

    // Initially display the raster in greyscale using the
    // data from the first image band
    Style rasterStyle = createGreyscaleStyle(1);

    // Connect to the shapefile
    FileDataStore dataStore = FileDataStoreFinder.getDataStore(shpFile);
    SimpleFeatureSource shapefileSource = dataStore
            .getFeatureSource();

    // Create a basic style with yellow lines and no fill
    Style shpStyle = SLD.createPolygonStyle(Color.YELLOW, null, 0.0f);

    // Set up a MapContent with the two layers
    final MapContent map = new MapContent();
    map.setTitle("ImageLab");

    Layer rasterLayer = new GridReaderLayer(reader, rasterStyle);
    map.addLayer(rasterLayer);

El problema es que para los archivos GeoTiff de mayor tamaño (por ejemplo, 30 MB) la representación tarda un par de segundos en un equipo actualizado, lo que resulta especialmente problemático si el usuario utiliza funciones como el zoom.

¿Hay alguna manera de utilizar la API de forma diferente para acelerar el proceso? He hecho un perfil aproximado pero sólo he visto que el renderizador trabaja un par de segundos si se refresca la imagen.

El GeoTiff se creó con gdal

gdal_translate -of GTiff -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -co TILED=yes -a_srs EPSG:4326'

1voto

Adam Ernst Puntos 6939

En discutido de Paul Ramsey además de comprimir y embaldosar las imágenes es necesario proporcionar vistas generales para evitar que GeoTools (y otros programas) tengan que leer todo el archivo cuando se aleja el zoom.

Utilice gdaladdo para añadir resúmenes:

gdaladdo \
  --config COMPRESS_OVERVIEW JPEG \
  --config PHOTOMETRIC_OVERVIEW YCBCR \
  --config INTERLEAVE_OVERVIEW PIXEL \
  -r average \
  5255C_JPEG_YCBCR.tif \
  2 4 8 16

i-Ciencias.com

I-Ciencias es una comunidad de estudiantes y amantes de la ciencia en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X