geopackage-sdk/src/main/java/mil/nga/geopackage/extension/coverage/CoverageData.java
@Override
    public CoverageDataResults getValues(CoverageDataRequest request,
                                         Integer width, Integer height) {

        CoverageDataResults coverageDataResults = null;

        // Transform to the projection of the coverage data tiles
        ProjectionTransform transformRequestToCoverage = null;
        BoundingBox requestProjectedBoundingBox = request.getBoundingBox();
        if (!sameProjection) {
            transformRequestToCoverage = requestProjection
                    .getTransformation(coverageProjection);
            requestProjectedBoundingBox = requestProjectedBoundingBox
                    .transform(transformRequestToCoverage);
        }
        request.setProjectedBoundingBox(requestProjectedBoundingBox);

        // Determine how many overlapping pixels to store based upon the
        // algorithm
        int overlappingPixels;
        switch (algorithm) {
            case BICUBIC:
                overlappingPixels = 3;
                break;
            default:
                overlappingPixels = 1;
        }

        // Find the tile matrix and results
        CoverageDataTileMatrixResults results = getResults(request,
                requestProjectedBoundingBox, overlappingPixels);

        if (results != null) {

            TileMatrix tileMatrix = results.getTileMatrix();
            TileCursor tileResults = results.getTileResults();

            try {

                // Determine the requested coverage data dimensions, or use the
                // dimensions of a single tile matrix coverage data tile
                int requestedCoverageDataWidth = width != null ? width
                        : (int) tileMatrix.getTileWidth();
                int requestedCoverageDataHeight = height != null ? height
                        : (int) tileMatrix.getTileHeight();

                // Determine the size of the non projected coverage data results
                int tileWidth = requestedCoverageDataWidth;
                int tileHeight = requestedCoverageDataHeight;
                if (!sameProjection) {
                    int projectedWidth = (int) Math
                            .round((requestProjectedBoundingBox
                                    .getMaxLongitude() - requestProjectedBoundingBox
                                    .getMinLongitude())
                                    / tileMatrix.getPixelXSize());
                    if (projectedWidth > 0) {
                        tileWidth = projectedWidth;
                    }
                    int projectedHeight = (int) Math
                            .round((requestProjectedBoundingBox
                                    .getMaxLatitude() - requestProjectedBoundingBox
                                    .getMinLatitude())
                                    / tileMatrix.getPixelYSize());
                    if (projectedHeight > 0) {
                        tileHeight = projectedHeight;
                    }
                }

                // Retrieve the coverage data from the results
                Double[][] values = getValues(tileMatrix, tileResults,
                        request, tileWidth, tileHeight, overlappingPixels);

                // Project the coverage data if needed
                if (values != null && !sameProjection && !request.isPoint()) {
                    values = reprojectCoverageData(values,
                            requestedCoverageDataWidth,
                            requestedCoverageDataHeight,
                            request.getBoundingBox(),
                            transformRequestToCoverage,
                            requestProjectedBoundingBox);
                }

                // Create the results
                if (values != null) {
                    coverageDataResults = new CoverageDataResults(values,
                            tileMatrix);
                }
            } finally {
                tileResults.close();
            }
        }

        return coverageDataResults;
    }
@Override
    public CoverageDataResults getValues(CoverageDataRequest request,
                                         Integer width, Integer height) {

        CoverageDataResults coverageDataResults = null;

        // Transform to the projection of the coverage data tiles
        ProjectionTransform transformRequestToCoverage = null;
        BoundingBox requestProjectedBoundingBox = request.getBoundingBox();
        if (!sameProjection) {
            transformRequestToCoverage = requestProjection
                    .getTransformation(coverageProjection);
            requestProjectedBoundingBox = requestProjectedBoundingBox
                    .transform(transformRequestToCoverage);
        }
        request.setProjectedBoundingBox(requestProjectedBoundingBox);

        // Determine how many overlapping pixels to store based upon the
        // algorithm
        int overlappingPixels;
        switch (algorithm) {
            case BICUBIC:
                overlappingPixels = 3;
                break;
            default:
                overlappingPixels = 1;
        }

        // Find the tile matrix and results
        CoverageDataTileMatrixResults results = getResults(request,
                requestProjectedBoundingBox, overlappingPixels);

        if (results != null) {

            TileMatrix tileMatrix = results.getTileMatrix();
            TileCursor tileResults = results.getTileResults();

            try {

                // Determine the requested coverage data dimensions, or use the
                // dimensions of a single tile matrix coverage data tile
                int requestedCoverageDataWidth = width != null ? width
                        : (int) tileMatrix.getTileWidth();
                int requestedCoverageDataHeight = height != null ? height
                        : (int) tileMatrix.getTileHeight();

                // Determine the size of the non projected coverage data results
                int tileWidth = requestedCoverageDataWidth;
                int tileHeight = requestedCoverageDataHeight;
                if (!sameProjection) {
                    int projectedWidth = (int) Math
                            .round((requestProjectedBoundingBox
                                    .getMaxLongitude() - requestProjectedBoundingBox
                                    .getMinLongitude())
                                    / tileMatrix.getPixelXSize());
                    if (projectedWidth > 0) {
                        tileWidth = projectedWidth;
                    }
                    int projectedHeight = (int) Math
                            .round((requestProjectedBoundingBox
                                    .getMaxLatitude() - requestProjectedBoundingBox
                                    .getMinLatitude())
                                    / tileMatrix.getPixelYSize());
                    if (projectedHeight > 0) {
                        tileHeight = projectedHeight;
                    }
                }

                // Retrieve the coverage data from the results
                Double[][] values = getValues(tileMatrix, tileResults,
                        request, tileWidth, tileHeight, overlappingPixels);

                // Project the coverage data if needed
                if (values != null && !sameProjection && !request.isPoint()) {
                    values = reprojectCoverageData(values,
                            requestedCoverageDataWidth,
                            requestedCoverageDataHeight,
                            request.getBoundingBox(),
                            transformRequestToCoverage,
                            requestProjectedBoundingBox);
                }

                // Create the results
                if (values != null) {
                    coverageDataResults = new CoverageDataResults(values,
                            tileMatrix);
                }
            } finally {
                tileResults.close();
            }
        }

        return coverageDataResults;
    }
{@inheritDoc}