Package org.geotools.coverage.grid

Examples of org.geotools.coverage.grid.GridGeometry2D


            //
            // the crs of the request and the one of the coverage are NOT the
            // same and the conversion is not , we can get the resolution from envelope + raster directly
            //
            GridGeometry2D gridGeometry;
            if (needsReprojection) {
                final GridToEnvelopeMapper geMapper = new GridToEnvelopeMapper(new GridEnvelope2D(
                        computedRasterArea), computedBBox);
                computedGridToWorld = geMapper.createAffineTransform();
                if (accurateResolution) {
                    gridGeometry = requestedGridGeometry;
                } else {
                    gridGeometry = new GridGeometry2D(new GridEnvelope2D(computedRasterArea),
                            computedBBox);
                }
            } else {
                gridGeometry = requestedGridGeometry;
                computedGridToWorld = requestedGridToWorld;
View Full Code Here


        // //
        if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName())) {
            final Object value = param.getValue();
            if (value == null)
                return;
            final GridGeometry2D gg = (GridGeometry2D) value;
            request.setDomainSubset(gg.getGridRange2D(), gg.getGridToCRS2D(),
                    gg.getCoordinateReferenceSystem());
            return;
        }

        // //
        //
View Full Code Here

        // prepare a request that crosses the bounds for a really minimal part
        GeneralEnvelope ge = reader.getOriginalEnvelope();
        ReferencedEnvelope requestedEnvelope = new ReferencedEnvelope(ge.getMinimum(0) - 5, ge.getMinimum(0),
                ge.getMinimum(1), ge.getMaximum(1), ge.getCoordinateReferenceSystem());
        final Parameter<GridGeometry2D> readGG = new Parameter<GridGeometry2D>(AbstractGridFormat.READ_GRIDGEOMETRY2D);
        readGG.setValue(new GridGeometry2D(new GridEnvelope2D(0, 0, 400, 400), requestedEnvelope));
       
        // make sure we get back a null, not an exception
        assertNull(reader.read(new GeneralParameterValue[] {readGG}));
    }
View Full Code Here

        oldEnvelop.getLowerCorner().getOrdinate(0)
            + oldEnvelop.getSpan(0) / 2,
        oldEnvelop.getLowerCorner().getOrdinate(1)
            + oldEnvelop.getSpan(1) / 2 });
    cropEnvelope.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
    gg.setValue(new GridGeometry2D(new GridEnvelope2D(new Rectangle(0, 0,
        250, 250)), cropEnvelope));

    //
    // Show the coverage
    //
View Full Code Here

        oldEnvelop.getLowerCorner().getOrdinate(0)
            + oldEnvelop.getSpan(0) / 2,
        oldEnvelop.getLowerCorner().getOrdinate(1)
            + oldEnvelop.getSpan(1) / 2 });
    cropEnvelope.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
    gg.setValue(new GridGeometry2D(new GridEnvelope2D(new Rectangle(0, 0,
        125, 125)), cropEnvelope));

    //
    // Show the coverage
    //
View Full Code Here

        oldEnvelop.getLowerCorner().getOrdinate(0)
            + oldEnvelop.getSpan(0) / 2,
        oldEnvelop.getLowerCorner().getOrdinate(1)
            + oldEnvelop.getSpan(1) / 2 });
    cropEnvelope.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
    gg.setValue(new GridGeometry2D(new GridEnvelope2D(new Rectangle(0, 0,
        62, 62)), cropEnvelope));

    //
    // Show the coverage
    //
View Full Code Here

        oldEnvelop.getLowerCorner().getOrdinate(0)
            + oldEnvelop.getSpan(0) / 2,
        oldEnvelop.getLowerCorner().getOrdinate(1)
            + oldEnvelop.getSpan(1) / 2 });
    cropEnvelope.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
    gg.setValue(new GridGeometry2D(new GridEnvelope2D(new Rectangle(0, 0,
        25, 25)), cropEnvelope));

    //
    // Show the coverage
    //
View Full Code Here

    final Dimension dim= new Dimension();
    dim.setSize(reader.getOriginalGridRange().getSpan(0)/2.0, reader.getOriginalGridRange().getSpan(1)/2.0);
    final Rectangle rasterArea=(( GridEnvelope2D)reader.getOriginalGridRange());
    rasterArea.setSize(dim);
    final GridEnvelope2D range= new GridEnvelope2D(rasterArea);
    gg.setValue(new GridGeometry2D(range,envelope));
   
    final SimpleDateFormat formatD = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    formatD.setTimeZone(TimeZone.getTimeZone("GMT"));
   
    // use imageio with defined tiles
View Full Code Here

      final int length = params.length;
      for (int i = 0; i < length; i++) {
        final ParameterValue param = (ParameterValue) params[i];
        final String name = param.getDescriptor().getName().getCode();
        if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) {
          final GridGeometry2D gg = (GridGeometry2D) param.getValue();
          readEnvelope = new GeneralEnvelope((Envelope) gg.getEnvelope2D());
          requestedDim = gg.getGridRange2D().getBounds();
          continue;
        }
        if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) {
          overviewPolicy=(OverviewPolicy) param.getValue();
        }
View Full Code Here

//        if (granulesPaths != null) {
//            properties = new HashMap<String, String>();
//            properties.put(AbstractGridCoverage2DReader.FILE_SOURCE_PROPERTY, granulesPaths);
//        }
//        image = TransposeDescriptor.create(image, TransposeDescriptor.FLIP_VERTICAL, hints);
        return COVERAGE_FACTORY.create(request.name, image, new GridGeometry2D(new GridEnvelope2D(PlanarImage.wrapRenderedImage(image)
                        .getBounds()), PixelInCell.CELL_CORNER, finalGridToWorldCorner,
                        this.targetBBox.getCoordinateReferenceSystem(), hints), sampleDimensions, null,
                properties);
    }
View Full Code Here

TOP

Related Classes of org.geotools.coverage.grid.GridGeometry2D

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.