Class CoverageDataPng

    • Constructor Detail

      • 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 Detail

      • 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
      • getPixelValue

        public short getPixelValue​(BufferedImage image,
                                   int x,
                                   int y)
        Get the pixel value as an "unsigned short"
        Parameters:
        image - tile image
        x - x coordinate
        y - y coordinate
        Returns:
        "unsigned short" pixel value
      • getUnsignedPixelValue

        public int getUnsignedPixelValue​(BufferedImage image,
                                         int x,
                                         int y)
        Get the pixel value as a 16 bit unsigned integer value
        Parameters:
        image - tile image
        x - x coordinate
        y - y coordinate
        Returns:
        unsigned integer pixel value
      • getPixelValue

        public short getPixelValue​(WritableRaster raster,
                                   int x,
                                   int y)
        Get the pixel value as an "unsigned short" from the raster and the coordinate
        Parameters:
        raster - image raster
        x - x coordinate
        y - y coordinate
        Returns:
        "unsigned short" pixel value
      • getUnsignedPixelValue

        public int getUnsignedPixelValue​(WritableRaster raster,
                                         int x,
                                         int y)
        Get the pixel value as a 16 bit unsigned integer value
        Parameters:
        raster - image raster
        x - x coordinate
        y - y coordinate
        Returns:
        unsigned integer pixel value
      • getPixelValues

        public short[] getPixelValues​(BufferedImage image)
        Get the pixel values of the buffered image as "unsigned shorts"
        Parameters:
        image - tile image
        Returns:
        "unsigned short" pixel values
      • getUnsignedPixelValues

        public int[] getUnsignedPixelValues​(BufferedImage image)
        Get the pixel values of the buffered image as 16 bit unsigned integer values
        Parameters:
        image - tile image
        Returns:
        unsigned integer pixel values
      • getPixelValues

        public short[] getPixelValues​(WritableRaster raster)
        Get the pixel values of the raster as "unsigned shorts"
        Parameters:
        raster - image raster
        Returns:
        "unsigned short" pixel values
      • getUnsignedPixelValues

        public int[] getUnsignedPixelValues​(WritableRaster raster)
        Get the pixel values of the raster as 16 bit unsigned integer values
        Parameters:
        raster - image raster
        Returns:
        unsigned integer pixel values
      • validateImageType

        public void validateImageType​(BufferedImage image)
        Validate that the image type is an unsigned short
        Parameters:
        image - tile image
      • 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
      • getValue

        public Double getValue​(GriddedTile griddedTile,
                               BufferedImage image,
                               int x,
                               int y)
        Get the coverage data value
        Parameters:
        griddedTile - gridded tile
        image - tile image
        x - x coordinate
        y - y coordinate
        Returns:
        coverage data value
      • getValue

        public Double getValue​(GriddedTile griddedTile,
                               WritableRaster raster,
                               int x,
                               int y)
        Get the coverage data value
        Parameters:
        griddedTile - gridded tile
        raster - image raster
        x - x coordinate
        y - y coordinate
        Returns:
        coverage data value
      • getValues

        public Double[] getValues​(GriddedTile griddedTile,
                                  BufferedImage image)
        Get the coverage data values
        Parameters:
        griddedTile - gridded tile
        image - tile image
        Returns:
        coverage data values
      • getValues

        public Double[] getValues​(GriddedTile griddedTile,
                                  WritableRaster raster)
        Get the coverage data values
        Parameters:
        griddedTile - gridded tile
        raster - raster image
        Returns:
        coverage data values
      • drawTile

        public BufferedImage 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 BufferedImage 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 BufferedImage 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 BufferedImage 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 BufferedImage 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 image 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 BufferedImage 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 image bytes from the double array of unsigned 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 BufferedImage createImage​(int tileWidth,
                                         int tileHeight)
        Create a new unsigned 16 bit short grayscale image
        Parameters:
        tileWidth - tile width
        tileHeight - tile height
        Returns:
        image
      • getImageBytes

        public byte[] getImageBytes​(BufferedImage image)
        Get the image as PNG bytes
        Parameters:
        image - buffered image
        Returns:
        image bytes
      • setPixelValue

        public void setPixelValue​(WritableRaster raster,
                                  int x,
                                  int y,
                                  short pixelValue)
        Set the "unsigned short" pixel value into the image raster
        Parameters:
        raster - image raster
        x - x coordinate
        y - y coordinate
        pixelValue - "unsigned short" pixel value
      • setPixelValue

        public void setPixelValue​(WritableRaster raster,
                                  int x,
                                  int y,
                                  int unsignedPixelValue)
        Set the unsigned 16 bit integer pixel value into the image raster
        Parameters:
        raster - image raster
        x - x coordinate
        y - y coordinate
        unsignedPixelValue - unsigned 16 bit integer 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