browser-image
    Preparing search index...
    • A raster as a tiled GeoTIFF with overviews, keeping its sample type, band count, no-data value and georeferencing. Use it to give a GeoTIFF that has no overviews (a plain, non-cloud-optimized one) the levels OpenLayers reads when zoomed out: without them every view is drawn from the full image and looks jagged when zoomed out. Overviews average 2×2 pixels per band, leaving out no-data and NaN.

      With statistics: true each band's lowest and highest value (no-data and NaN left out) are written as GDAL metadata (STATISTICS_MINIMUM / STATISTICS_MAXIMUM). OpenLayers then maps that range to 0-255 instead of the whole range of the sample type, so 16-bit and float data (elevations, 11-bit satellite images) are not crushed into a few gray levels.

      Parameters

      • raster: GeoTIFFRaster
      • options: { tileSize?: number; statistics?: boolean } = {}

      Returns Blob

      const image = await (await fromBlob(file)).getImage();
      const data = (await image.readRasters({ interleave: true })) as Uint16Array;
      const fd = image.fileDirectory;
      const blob = rasterToGeoTIFF({
      width: image.getWidth(), height: image.getHeight(), bands: image.getSamplesPerPixel(), data,
      noData: image.getGDALNoData(),
      geo: { modelPixelScale: fd.ModelPixelScale, modelTiepoint: fd.ModelTiepoint, geoKeyDirectory: fd.GeoKeyDirectory },
      });