Package org.geotools.geometry

Examples of org.geotools.geometry.GeneralEnvelope


            if (boundingBoxes.isEmpty()) {
                crs = DefaultGeographicCRS.WGS84;
                // env = layer.getLatLonBoundingBox();
                env = layer.getEnvelope(crs);
            } else {
                GeneralEnvelope layerDefinedEnv = layer.getEnvelope(DefaultGeographicCRS.WGS84);

                CRSEnvelope bbox;
                String epsg4326 = "EPSG:4326"; //$NON-NLS-1$
                String epsg4269 = "EPSG:4269"; //$NON-NLS-1$
View Full Code Here


        boolean isOnGrid = false;
        boolean hasProblem = false;
        Point2D p = null;
        if (geoResource.canResolve(AbstractGridCoverage2DReader.class)) {
            AbstractGridCoverage2DReader reader = geoResource.resolve(AbstractGridCoverage2DReader.class, monitor);
            GeneralEnvelope originalEnvelope = reader.getOriginalEnvelope();
            CoordinateReferenceSystem targetCrs = reader.getCrs();

            if (targetCrs != null) {
                evaluateCoord = transform(sourceCRS, targetCrs, envelopeCenterOrig);
            } else {
                evaluateCoord = envelopeCenterOrig;
                targetCrs = sourceCRS;
            }
            p = new Point2D.Double(evaluateCoord.x, evaluateCoord.y);
            if (originalEnvelope.contains(new DirectPosition2D(p))) {
                double delta = 0.0000001;
                GeneralParameterValue[] parameterValues = createGridGeometryGeneralParameter(1, 1, evaluateCoord.y + delta,
                        evaluateCoord.y - delta, evaluateCoord.x + delta, evaluateCoord.x - delta, targetCrs);
                coverage = reader.read(parameterValues);
                /*
 
View Full Code Here

            CoordinateReferenceSystem CRS = reader.getCrs();

            if (!(CRS instanceof DefaultEngineeringCRS))
                numberOfAvailableInfoFields++;
           
            GeneralEnvelope env = reader.getOriginalEnvelope();
           
            if (!(env.isEmpty() || env.isNull() || env.isInfinite()))
                numberOfAvailableInfoFields++;

            completeness = (double) numberOfexpectedInfoFields
                    / (double) numberOfAvailableInfoFields;
View Full Code Here

                AbstractGridCoverage2DReader source = this.resource.service(new NullProgressMonitor()).getReader(null);
                if (source == null) {
                    return null;
                }

                GeneralEnvelope ptBounds = source.getOriginalEnvelope();
                Envelope env = new Envelope(ptBounds.getMinimum(0), ptBounds.getMaximum(0),
                        ptBounds.getMinimum(1), ptBounds.getMaximum(1));

                CoordinateReferenceSystem geomcrs = source.getCrs();
                if (geomcrs == null) {
                    geomcrs = DefaultEngineeringCRS.GENERIC_2D;
                }
View Full Code Here

    }
    private GridCoverage2D convertImageToGridCoverage( ReferencedEnvelope requestBBox,
            BufferedImage image ) throws RenderException {
        Envelope env = requestBBox;
        GeneralEnvelope gtEnv = new GeneralEnvelope(new double[]{env.getMinX(), env.getMinY()},
                new double[]{env.getMaxX(), env.getMaxY()});

        try {
            gtEnv.setCoordinateReferenceSystem(requestBBox.getCoordinateReferenceSystem());
        } catch (Exception e) {
            throw wrapException(e);
        }

        GridCoverageFactory factory = new GridCoverageFactory();
View Full Code Here

    }
   
    public static ReferencedEnvelope getLayersBoundingBox( CoordinateReferenceSystem crs, List<Layer> layers,String version ) {
        ReferencedEnvelope envelope = null;
        for( Layer layer : layers ) {
            GeneralEnvelope temp = layer.getEnvelope(crs);           
            if (temp != null) {
                ReferencedEnvelope jtsTemp = ReferencedEnvelope.reference( temp );
//              if( version != null && version.startsWith("1.3")){
//                  jtsTemp = swapAxis(jtsTemp);
//              }
View Full Code Here

        if (coverage.get() == null) {
            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
View Full Code Here

        //
        // ///////////////////////////////////////////////////////////////////
        final GridCoverage2D croppedGridCoverage;

        // intersect the envelopes
        final GeneralEnvelope intersectionEnvelope = new GeneralEnvelope(destinationEnvelopeInSourceCRS);
        intersectionEnvelope.setCoordinateReferenceSystem(sourceCRS);
        intersectionEnvelope.intersect((GeneralEnvelope) sourceEnvelope);

        // dow we have something to show?
        if (intersectionEnvelope.isEmpty()) {
            throw new WcsException("The Intersection is null. Check the requested BBOX!");
        }

        if (!intersectionEnvelope.equals((GeneralEnvelope) sourceEnvelope)) {
            // get the cropped grid geometry
            // final GridGeometry2D cropGridGeometry = getCroppedGridGeometry(
            // intersectionEnvelope, gridCoverage);

            /* Operations.DEFAULT.crop(coverage, intersectionEnvelope) */
            final ParameterValueGroup param = (ParameterValueGroup) cropParams.clone();
            param.parameter("Source").setValue(coverage);
            param.parameter("Envelope").setValue(intersectionEnvelope);
            param.parameter("ConserveEnvelope").setValue(conserveEnvelope);

            croppedGridCoverage = (GridCoverage2D) cropFactory.doOperation(param, hints);
        } else {
            croppedGridCoverage = (GridCoverage2D) coverage;
        }

        // prefetch to be faster afterwards.
        // This step is important since at this stage we might be loading tiles
        // from disk
        croppedGridCoverage.prefetch(intersectionEnvelope.toRectangle2D());

        return croppedGridCoverage;
    }
View Full Code Here

      final MathTransform GCCRSTodeviceCRSTransform = CRS.findMathTransform(cvCRS, targetCRS, true);
      final MathTransform deviceCRSToGCCRSTransform = GCCRSTodeviceCRSTransformdeviceCRSToGCCRSTransform
          .inverse();
 
      com.vividsolutions.jts.geom.Envelope envelope = request.getBbox();
      GeneralEnvelope destinationEnvelope;
      final boolean lonFirst = sourceCRS.getCoordinateSystem().getAxis(0).getDirection().absolute()
                                        .equals(AxisDirection.EAST);
 
      // the envelope we are provided with is lon,lat always
      if (!lonFirst) {
          destinationEnvelope = new GeneralEnvelope(new double[] {
                      envelope.getMinY(), envelope.getMinX()
                  }, new double[] { envelope.getMaxY(), envelope.getMaxX() });
      } else {
          destinationEnvelope = new GeneralEnvelope(new double[] {
                      envelope.getMinX(), envelope.getMinY()
                  }, new double[] { envelope.getMaxX(), envelope.getMaxY() });
      }
 
      destinationEnvelope.setCoordinateReferenceSystem(sourceCRS);
 
      // this is the destination envelope in the coverage crs
      final GeneralEnvelope destinationEnvelopeInSourceCRS = (!deviceCRSToGCCRSTransform
          .isIdentity()) ? CRS.transform(deviceCRSToGCCRSTransform, destinationEnvelope)
                         : new GeneralEnvelope(destinationEnvelope);
      destinationEnvelopeInSourceCRS.setCoordinateReferenceSystem(cvCRS);
 
      /**
       * Reading Coverage on Requested Envelope
      */
      Rectangle destinationSize = null;
View Full Code Here

    public void formatImageOutputStream(RenderedImage image, OutputStream outStream)
        throws WmsException, IOException {
        // crating a grid coverage
        final GridCoverage2D gc = factory.create("geotiff", image,
                new GeneralEnvelope(mapContext.getAreaOfInterest()));

        // tiff
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Writing tiff image ...");
        }
View Full Code Here

TOP

Related Classes of org.geotools.geometry.GeneralEnvelope

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.