Class CoverageDataPng


public class CoverageDataPng extends CoverageData<CoverageDataPngImage>
Tiled Gridded Coverage Data, PNG Encoding, Extension
Since:
2.0.1
  • Constructor Details

    • CoverageDataPng

      public CoverageDataPng(GeoPackage geoPackage, TileDao tileDao, Integer width, Integer height, Projection requestProjection)
      Constructor
      Parameters:
      geoPackage - GeoPackage
      tileDao - tile dao
      width - coverage data response width
      height - coverage data response height
      requestProjection - request projection
    • CoverageDataPng

      public CoverageDataPng(GeoPackage geoPackage, TileDao tileDao)
      Constructor, use the coverage data tables pixel tile size as the request size width and height
      Parameters:
      geoPackage - GeoPackage
      tileDao - tile dao
    • CoverageDataPng

      public CoverageDataPng(GeoPackage geoPackage, TileDao tileDao, Projection requestProjection)
      Constructor, use the coverage data tables pixel tile size as the request size width and height, request as the specified projection
      Parameters:
      geoPackage - GeoPackage
      tileDao - tile dao
      requestProjection - request projection
  • Method Details

    • createImage

      public CoverageDataPngImage createImage(TileRow tileRow)
      Create a coverage data image
      Specified by:
      createImage in class CoverageData<CoverageDataPngImage>
      Parameters:
      tileRow - tile row
      Returns:
      image
    • getValue

      public double getValue(GriddedTile griddedTile, TileRow tileRow, int x, int y)
      Get the coverage data value of the pixel in the tile row image
      Specified by:
      getValue in class CoverageData<CoverageDataPngImage>
      Parameters:
      griddedTile - gridded tile
      tileRow - tile row
      x - x coordinate
      y - y coordinate
      Returns:
      coverage data value
    • getValue

      public Double getValue(GriddedTile griddedTile, CoverageDataPngImage image, int x, int y)
      Specified by:
      getValue in class CoverageDataCore<CoverageDataPngImage>
    • getPixelValue

      public int getPixelValue(byte[] imageBytes, int x, int y)
      Get the pixel value as a 16 bit unsigned integer value
      Parameters:
      imageBytes - image bytes
      x - x coordinate
      y - y coordinate
      Returns:
      pixel value
    • getPixelValues

      public int[] getPixelValues(byte[] imageBytes)
      Get the pixel values of the image as 16 bit unsigned integer values
      Parameters:
      imageBytes - image bytes
      Returns:
      16 bit unsigned integer pixel values
    • validateImageType

      public static void validateImageType(PngReader reader)
      Validate that the image type is single channel 16 bit
      Parameters:
      reader - png reader
    • getValue

      public Double getValue(GriddedTile griddedTile, byte[] imageBytes, int x, int y)
      Get the coverage data value
      Specified by:
      getValue in class CoverageData<CoverageDataPngImage>
      Parameters:
      griddedTile - gridded tile
      imageBytes - image bytes
      x - x coordinate
      y - y coordinate
      Returns:
      coverage data value
    • getValues

      public Double[] getValues(GriddedTile griddedTile, byte[] imageBytes)
      Get the coverage data values
      Specified by:
      getValues in class CoverageData<CoverageDataPngImage>
      Parameters:
      griddedTile - gridded tile
      imageBytes - image bytes
      Returns:
      coverage data values
    • drawTile

      public CoverageDataPngImage drawTile(short[] pixelValues, int tileWidth, int tileHeight)
      Draw a coverage data image tile from the flat array of "unsigned short" pixel values of length tileWidth * tileHeight where each pixel is at: (y * tileWidth) + x
      Parameters:
      pixelValues - "unsigned short" pixel values of length tileWidth * tileHeight
      tileWidth - tile width
      tileHeight - tile height
      Returns:
      coverage data image tile
    • drawTileData

      public byte[] drawTileData(short[] pixelValues, int tileWidth, int tileHeight)
      Draw a coverage data image tile and format as PNG bytes from the flat array of "unsigned short" pixel values of length tileWidth * tileHeight where each pixel is at: (y * tileWidth) + x
      Parameters:
      pixelValues - "unsigned short" pixel values of length tileWidth * tileHeight
      tileWidth - tile width
      tileHeight - tile height
      Returns:
      coverage data image tile bytes
    • drawTile

      public CoverageDataPngImage drawTile(short[][] pixelValues)
      Draw a coverage data tile from the double array of "unsigned short" pixel values formatted as short[row][width]
      Parameters:
      pixelValues - "unsigned short" pixel values as [row][width]
      Returns:
      coverage data image tile
    • drawTileData

      public byte[] drawTileData(short[][] pixelValues)
      Draw a coverage data tile and format as PNG bytes from the double array of "unsigned short" pixel values formatted as short[row][width]
      Parameters:
      pixelValues - "unsigned short" pixel values as [row][width]
      Returns:
      coverage data image tile bytes
    • drawTile

      public CoverageDataPngImage drawTile(int[] unsignedPixelValues, int tileWidth, int tileHeight)
      Draw a coverage data image tile from the flat array of unsigned 16 bit integer pixel values of length tileWidth * tileHeight where each pixel is at: (y * tileWidth) + x
      Parameters:
      unsignedPixelValues - unsigned 16 bit integer pixel values of length tileWidth * tileHeight
      tileWidth - tile width
      tileHeight - tile height
      Returns:
      coverage data image tile
    • drawTileData

      public byte[] drawTileData(int[] unsignedPixelValues, int tileWidth, int tileHeight)
      Draw a coverage data image tile and format as PNG bytes from the flat array of unsigned 16 bit integer pixel values of length tileWidth * tileHeight where each pixel is at: (y * tileWidth) + x
      Parameters:
      unsignedPixelValues - unsigned 16 bit integer pixel values of length tileWidth * tileHeight
      tileWidth - tile width
      tileHeight - tile height
      Returns:
      coverage data image tile bytes
    • drawTile

      public CoverageDataPngImage drawTile(int[][] unsignedPixelValues)
      Draw a coverage data image tile from the double array of unsigned 16 bit integer pixel values formatted as int[row][width]
      Parameters:
      unsignedPixelValues - unsigned 16 bit integer pixel values as [row][width]
      Returns:
      coverage data image tile
    • drawTileData

      public byte[] drawTileData(int[][] unsignedPixelValues)
      Draw a coverage data image tile and format as PNG bytes from the double array of unsigned 16 bit integer pixel values formatted as int[row][width]
      Parameters:
      unsignedPixelValues - unsigned 16 bit integer pixel values as [row][width]
      Returns:
      coverage data image tile bytes
    • drawTile

      public CoverageDataPngImage drawTile(GriddedTile griddedTile, Double[] values, int tileWidth, int tileHeight)
      Draw a coverage data image tile from the flat array of coverage data values of length tileWidth * tileHeight where each coverage data value is at: (y * tileWidth) + x
      Parameters:
      griddedTile - gridded tile
      values - coverage data values of length tileWidth * tileHeight
      tileWidth - tile width
      tileHeight - tile height
      Returns:
      coverage data image tile
    • drawTileData

      public byte[] drawTileData(GriddedTile griddedTile, Double[] values, int tileWidth, int tileHeight)
      Draw a coverage data image tile and format as TIFF bytes from the flat array of coverage data values of length tileWidth * tileHeight where each coverage data value is at: (y * tileWidth) + x
      Specified by:
      drawTileData in class CoverageData<CoverageDataPngImage>
      Parameters:
      griddedTile - gridded tile
      values - coverage data values of length tileWidth * tileHeight
      tileWidth - tile width
      tileHeight - tile height
      Returns:
      coverage data image tile bytes
    • drawTile

      public CoverageDataPngImage drawTile(GriddedTile griddedTile, Double[][] values)
      Draw a coverage data image tile from the double array of unsigned coverage data values formatted as Double[row][width]
      Parameters:
      griddedTile - gridded tile
      values - coverage data values as [row][width]
      Returns:
      coverage data image tile
    • drawTileData

      public byte[] drawTileData(GriddedTile griddedTile, Double[][] values)
      Draw a coverage data image tile and format as TIFF bytes from the double array of coverage data values formatted as Double[row][width]
      Specified by:
      drawTileData in class CoverageData<CoverageDataPngImage>
      Parameters:
      griddedTile - gridded tile
      values - coverage data values as [row][width]
      Returns:
      coverage data image tile bytes
    • createImage

      public CoverageDataPngImage createImage(int tileWidth, int tileHeight)
      Create a new 16 bit single channel image
      Parameters:
      tileWidth - tile width
      tileHeight - tile height
      Returns:
      image
    • setPixelValue

      public void setPixelValue(ImageLineInt row, int x, short pixelValue)
      Set the pixel value
      Parameters:
      row - image line row
      x - x coordinate
      pixelValue - pixel value
    • setPixelValue

      public void setPixelValue(int[] row, int x, short pixelValue)
      Set the pixel value
      Parameters:
      row - row array
      x - x coordinate
      pixelValue - pixel value
    • setPixelValue

      public void setPixelValue(ImageLineInt row, int x, int unsignedPixelValue)
      Set the pixel value
      Parameters:
      row - image line row
      x - x coordinate
      unsignedPixelValue - unsigned pixel value
    • setPixelValue

      public void setPixelValue(int[] row, int x, int unsignedPixelValue)
      Set the pixel value
      Parameters:
      row - row array
      x - x coordinate
      unsignedPixelValue - unsigned pixel value
    • createTileTable

      public static CoverageDataPng createTileTable(GeoPackage geoPackage, TileTableMetadata metadata)
      Create the coverage data tile table with metadata and extension
      Parameters:
      geoPackage - GeoPackage
      metadata - tile table metadata
      Returns:
      coverage data
      Since:
      4.0.0