Package org.geotools.coverage.grid

Examples of org.geotools.coverage.grid.GridGeometry2D


   */
  protected DefaultParameterDescriptor<GridGeometry> getWorldGridGeomDescriptor() {
    // this is a little dumb
      GridEnvelope2D gridRange = new GridEnvelope2D(new Rectangle(0,0,100,100));
    ReferencedEnvelope env = new ReferencedEnvelope(-180.0, 180.0,-90.0, 90.0, DefaultGeographicCRS.WGS84);
    GridGeometry2D world = new GridGeometry2D(gridRange, env);
 
    DefaultParameterDescriptor<GridGeometry> gridGeometryDescriptor = new DefaultParameterDescriptor<GridGeometry>(
        AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(),
        GridGeometry.class, null, world);
    return gridGeometryDescriptor;
View Full Code Here


            try {
                JGrassRegion r = jGrassMapEnvironment.getFileRegion();
                Envelope2D envelope = new Envelope2D(locationCrs, r.getWest(), r.getSouth(), r.getEast() - r.getWest(),
                        r.getNorth() - r.getSouth());
                GridEnvelope2D gridRange = new GridEnvelope2D(0, 0, r.getCols(), r.getRows());
                GridGeometry2D gridGeometry2D = new GridGeometry2D(gridRange, (org.opengis.geometry.Envelope) envelope);
                return adaptee.cast(gridGeometry2D);
            } catch (Exception e) {
                msg = e;
            }
        }
View Full Code Here

        } else {
            DirectPosition2D minDp = new DirectPosition2D(west, south);
            DirectPosition2D maxDp = new DirectPosition2D(east, north);
            env = new Envelope2D(minDp, maxDp);
        }
        readGG.setValue(new GridGeometry2D(gridEnvelope, env));
        readParams[0] = readGG;

        return readParams;
    }
View Full Code Here

        DirectPosition lowerCorner = envelope.getLowerCorner();
        double[] westSouth = lowerCorner.getCoordinate();
        DirectPosition upperCorner = envelope.getUpperCorner();
        double[] eastNorth = upperCorner.getCoordinate();

        GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
        GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
        int height = gridRange.height;
        int width = gridRange.width;

        AffineTransform gridToCRS = (AffineTransform) gridGeometry.getGridToCRS();
        double xRes = XAffineTransform.getScaleX0(gridToCRS);
        double yRes = XAffineTransform.getScaleY0(gridToCRS);

        envelopeParams.put(NORTH, eastNorth[1]);
        envelopeParams.put(SOUTH, westSouth[1]);
View Full Code Here

            } else {
                DirectPosition2D minDp = new DirectPosition2D(west, south);
                DirectPosition2D maxDp = new DirectPosition2D(east, north);
                env = new Envelope2D(minDp, maxDp);
            }
            readGridGeometry2DParam.setValue(new GridGeometry2D(gridEnvelope, env));

             currentContext.setStatus(ILayer.WORKING);
             setState( STARTING );
            
             ParameterValue[] parameterValues = group.values().toArray(new ParameterValue[0]);
View Full Code Here

           
            GridEnvelope range=new GridEnvelope2D(0,0, mapDisplay.getWidth(), mapDisplay.getHeight() );
           
            MathTransform displayToLayer=currentContext.worldToScreenMathTransform().inverse();
            ReferencingFactoryFinder.getMathTransformFactory(null).createConcatenatedTransform(displayToLayer, currentContext.getLayer().mapToLayerTransform());
            GridGeometry2D geom=new GridGeometry2D(range, displayToLayer, destinationCRS );

            currentContext.setStatus(ILayer.WORKING);
            setState( STARTING );
           
            GridCoverageLoader loader = geoResource.resolve(GridCoverageLoader.class, monitor);
View Full Code Here

   
   
    if (sampleSize != null){
      int rSize = (int) Math.ceil(Math.sqrt(sampleSize.doubleValue()));
      GridEnvelope2D gridRange = new GridEnvelope2D(new Rectangle(0,0, rSize, rSize));
      GridGeometry2D world = new GridGeometry2D(gridRange,  new ReferencedEnvelope(gcRaw.getEnvelope()));
      DefaultParameterDescriptor<GridGeometry> gridGeometryDescriptor = new DefaultParameterDescriptor<GridGeometry>(
          AbstractGridFormat.READ_GRIDGEOMETRY2D.getName()
              .toString(), GridGeometry.class, null, world);

      ParameterGroup readParams = new ParameterGroup(
View Full Code Here

    this.errorMessage = null;
    GridCoverage gcRaw = layer.read(null);
    if (sampleSize != null){
      int rSize = (int) Math.ceil(Math.sqrt(sampleSize.doubleValue()));
      GridEnvelope2D gridRange = new GridEnvelope2D(new Rectangle(0,0, rSize, rSize));
      GridGeometry2D world = new GridGeometry2D(gridRange,  new ReferencedEnvelope(gcRaw.getEnvelope()));
      DefaultParameterDescriptor<GridGeometry> gridGeometryDescriptor = new DefaultParameterDescriptor<GridGeometry>(
          AbstractGridFormat.READ_GRIDGEOMETRY2D.getName()
              .toString(), GridGeometry.class, null, world);

      ParameterGroup readParams = new ParameterGroup(
View Full Code Here

    this.errorMessage = null;
    GridCoverage gcRaw = layer.read(null);
    if (sampleSize != null){
      int rSize = (int) Math.ceil(Math.sqrt(sampleSize.doubleValue()));
      GridEnvelope2D gridRange = new GridEnvelope2D(new Rectangle(0,0, rSize, rSize));
      GridGeometry2D world = new GridGeometry2D(gridRange,  new ReferencedEnvelope(gcRaw.getEnvelope()));
      DefaultParameterDescriptor<GridGeometry> gridGeometryDescriptor = new DefaultParameterDescriptor<GridGeometry>(
          AbstractGridFormat.READ_GRIDGEOMETRY2D.getName()
              .toString(), GridGeometry.class, null, world);

      ParameterGroup readParams = new ParameterGroup(
View Full Code Here

            try {
                AbstractGridCoverage2DReader reader = resource.resolve(AbstractGridCoverage2DReader.class, monitor);

                GridEnvelope range = reader.getOriginalGridRange();
                GeneralEnvelope env = reader.getOriginalEnvelope();
                GridGeometry2D all = new GridGeometry2D(range, env);
                GridCoverage2D coverage2d = (GridCoverage2D) super.load(all, monitor);
                RenderedImage image = coverage2d.view(ViewType.RENDERED).getRenderedImage();

        RasteringsPlugin
            .log("WARNING.  Loading image fully into memory.  It is about " + size(image) + " MB in size decompressed", null); //$NON-NLS-1$//$NON-NLS-2$
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.