Package org.opengis.coverage.grid

Examples of org.opengis.coverage.grid.GridEnvelope


        CoverageInfo ci = getCatalog().getCoverageByName(TASMANIA_BM.getLocalPart());
        GridCoverage2D original = (GridCoverage2D) ci.getGridCoverage(null, null);
        coverages.add(original);

        // the grid should not be swapped since the target output is expressed in EPSG:XYWZ form
        GridEnvelope originalRange = original.getGridGeometry().getGridRange();
        GridEnvelope actualRange = result.getGridGeometry().getGridRange();
        assertEquals(originalRange.getSpan(0), actualRange.getSpan(0));
        assertEquals(originalRange.getSpan(1), actualRange.getSpan(1));

        // check also the geographic bounds
        Envelope2D originalEnv = original.getEnvelope2D();
        Envelope2D actualEnv = result.getEnvelope2D();
        assertEquals(originalEnv.getMinX(), actualEnv.getMinX(), 1e-6);
View Full Code Here


        //   (with time and elevation there might be hundreds of superimposed tiles)
        // - reading the GridCoverage subset
        //

        final GeneralEnvelope originalEnvelope = reader.getOriginalEnvelope();
        final GridEnvelope originalRange = reader.getOriginalGridRange();           
        final Format coverageFormat = reader.getFormat();

        final ParameterValueGroup readParams = coverageFormat.getReadParameters();
        final Map parameters = CoverageUtils.getParametersKVP(readParams);
        final int minX = originalRange.getLow(0);
        final int minY = originalRange.getLow(1);
        final int width = originalRange.getSpan(0);
        final int height = originalRange.getSpan(1);
        final int maxX = minX + (width <= 5 ? width : 5);
        final int maxY = minY + (height <= 5 ? height : 5);

        // we have to be sure that we are working against a valid grid range.
        final GridEnvelope2D testRange = new GridEnvelope2D(minX, minY, maxX, maxY);
View Full Code Here

    }

    private GridCoverage2D displaceCoverage(GridCoverage2D coverage, double offset) {
        // let's compute the new grid geometry
        GridGeometry2D originalGG = coverage.getGridGeometry();
        GridEnvelope gridRange = originalGG.getGridRange();
        Envelope2D envelope = originalGG.getEnvelope2D();

        double minx = envelope.getMinX() + offset;
        double miny = envelope.getMinY();
        double maxx = envelope.getMaxX() + offset;
View Full Code Here

        Envelope envB = coverageB.getEnvelope();
        if (!envA.equals(envB)) {
            throw new ProcessException(MISMATCHING_ENVELOPE_MESSAGE);
        }
       
        GridEnvelope gridRangeA = coverageA.getGridGeometry().getGridRange();
        GridEnvelope gridRangeB = coverageA.getGridGeometry().getGridRange();
        if (gridRangeA.getSpan(0) != gridRangeB.getSpan(0)
                || gridRangeA.getSpan(1) != gridRangeB.getSpan(1)) {
            throw new ProcessException(MISMATCHING_GRID_MESSAGE);
        }
    }
View Full Code Here

            //
            // PREPARE DESTINATION DIMENSIONS
            //
            final Rectangle destinationSize;
            final AffineTransform2D destinationG2W;
            final GridEnvelope limits = grid.getLimits();
            if (limits != null) {
                //
                // we have imposed limits from the request, we just use them as they are
                //
                final int[] lowers = limits.getLow().getCoordinateValues();
                destinationG2W = null;
                destinationSize = new Rectangle(lowers[0], lowers[1], limits.getSpan(0), limits
                        .getSpan(1));
            } else if (grid.getOffsetVector() != null && grid.getOffsetVector().size() > 0) {
                //
                // we have NO imposed limits from the request, we need to create a proper G2W with
                // the RESOLUTION we where given.
View Full Code Here

            targetCoverage = readerTarget.read(null);
            final CoordinateReferenceSystem targetCRS=CRS.decode("EPSG:3857", true);
            Assert.assertTrue(CRS.equalsIgnoreMetadata(targetCoverage.getCoordinateReferenceSystem(), targetCRS));           

            // checks
            final GridEnvelope gridRange = targetCoverage.getGridGeometry().getGridRange();
           
            final GeneralEnvelope expectedEnvelope= new GeneralEnvelope(
                    new double[]{1.6308305401213994E7,-5543147.203861462},
                    new double[]{1.6475284637403902E7,-5311971.846945147});   
            expectedEnvelope.setCoordinateReferenceSystem(targetCRS);

            final double scale = getScale(targetCoverage);
            assertEnvelopeEquals(expectedEnvelope,scale,(GeneralEnvelope) targetCoverage.getEnvelope(),scale);
            assertEquals(gridRange.getSpan(0), 360);
            assertEquals(gridRange.getSpan(1), 360);
           
        } finally {
            try{
                readerTarget.dispose();
            } catch (Exception e) {
View Full Code Here

            targetCoverage = readerTarget.read(null);
            final CoordinateReferenceSystem targetCRS=CRS.decode("EPSG:3857", true);
            Assert.assertTrue(CRS.equalsIgnoreMetadata(targetCoverage.getCoordinateReferenceSystem(), targetCRS));           

            // checks
            final GridEnvelope gridRange = targetCoverage.getGridGeometry().getGridRange();
           
            final GeneralEnvelope expectedEnvelope= new GeneralEnvelope(
                    new double[]{1.6308305401213994E7,-5388389.272818998},
                    new double[]{1.636396514661063E7,-5311971.846945147});   
            expectedEnvelope.setCoordinateReferenceSystem(targetCRS);

            final double scale = getScale(targetCoverage);
            assertEnvelopeEquals(expectedEnvelope,scale,(GeneralEnvelope) targetCoverage.getEnvelope(),scale);
            assertEquals(gridRange.getSpan(0), 120);
            assertEquals(gridRange.getSpan(1), 120);
           
        } finally {
            try{
                readerTarget.dispose();
            } catch (Exception e) {
View Full Code Here

        // original range
        final Rectangle2D.Double rasterArea = new Rectangle2D.Double();
        rasterArea.setFrameFromCenter(rasterMid.getOrdinate(0), rasterMid.getOrdinate(1),
                rasterMid.getOrdinate(0) + 10, rasterMid.getOrdinate(1) + 10);
        final Rectangle integerRasterArea = rasterArea.getBounds();
        final GridEnvelope gridEnvelope = reader.getOriginalGridRange();
        final Rectangle originalArea = (gridEnvelope instanceof GridEnvelope2D) ? (GridEnvelope2D) gridEnvelope
                : new Rectangle();
        XRectangle2D.intersect(integerRasterArea, originalArea, integerRasterArea);
        // paranoiac check, did we fall outside the coverage raster area? This should
        // never really happne if the request is well formed.
View Full Code Here

         * @param elevationMetadata
         * @throws Exception
         */
        private void handleGrid(CoverageInfo ci) throws Exception {
          final GridGeometry originalGrid = ci.getGrid();
          final GridEnvelope gridRange=originalGrid.getGridRange();
          final AffineTransform2D gridToCRS = (AffineTransform2D) originalGrid.getGridToCRS();
            final int gridDimension = (gridToCRS != null ? gridToCRS.getSourceDimensions() : 0);

            AttributesImpl attributes = new AttributesImpl();
            attributes.addAttribute("", "dimension", "dimension", "", String.valueOf(gridDimension));
            attributes.addAttribute("", "srsName", "srsName", "", ci.getSRS());

            // RectifiedGrid
            start("gml:RectifiedGrid", attributes);
           
            // Grid Envelope
            String lowers = "";
            String uppers = "";
            for (int r = 0; r < gridDimension; r++) {
                if (gridToCRS.getSourceDimensions() > r) {
                    lowers += (gridRange.getLow(r) + " ");
                    uppers += (gridRange.getHigh(r) + " ");
                } else {
                    lowers += (0 + " ");
                    uppers += (0 + " ");
                }
            }
View Full Code Here

        GridType grid = (GridType) gc.getDomainSubset().getSpatialSubset().getGrid().get(0);
        assertEquals(grid.getSrsName(), "EPSG:4326");
        assertEquals(grid.getAxisName().get(0), "Column");
        assertEquals(grid.getAxisName().get(1), "Row");

        GridEnvelope gridLimits = grid.getLimits();
        assertEquals(0, gridLimits.getLow(0));
        assertEquals(0, gridLimits.getLow(1));
        assertEquals(544, gridLimits.getHigh(0));
        assertEquals(489, gridLimits.getHigh(1));

        RangeSubsetType rangeSet = gc.getRangeSubset();
        AxisSubsetType axisSubset = (AxisSubsetType) rangeSet.getAxisSubset().get(0);
        assertEquals("Band", axisSubset.getName());
        assertEquals(axisSubset.getSingleValue().size(), 0);
View Full Code Here

TOP

Related Classes of org.opengis.coverage.grid.GridEnvelope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.