Package org.geotools.geometry.jts

Examples of org.geotools.geometry.jts.ReferencedEnvelope.transform()


        final CoordinateReferenceSystem featureTypeCrs = featureTypeBounds
                .getCoordinateReferenceSystem();
        final CoordinateReferenceSystem queryCrs = query.getCoordinateSystem();
        if (queryCrs != null && !CRS.equalsIgnoreMetadata(queryCrs, featureTypeCrs)) {
            try {
                featureTypeBounds = featureTypeBounds.transform(queryCrs, true);
            } catch (TransformException e) {
                LOGGER.log(Level.INFO, "Error transforming bounds for " + typeName, e);
                featureTypeBounds = null;
            } catch (FactoryException e) {
                LOGGER.log(Level.INFO, "Error transforming bounds for " + typeName, e);
View Full Code Here


                ReferencedEnvelope referencedEnvelope = new ReferencedEnvelope(env,
                        DefaultGeographicCRS.WGS84);

                try {
                    return referencedEnvelope.transform(CRS.decode(fsd.getSRS(), true), true);
                } catch (NoSuchAuthorityCodeException e) {
                    return referencedEnvelope;
                } catch (TransformException e) {
                    return referencedEnvelope;
                } catch (FactoryException e) {
View Full Code Here

    public void testBounds() throws Exception {
        ReprojectingFeatureCollection rfc = new ReprojectingFeatureCollection(delegate, target);
        ReferencedEnvelope bounds = delegate.getBounds();
        // the reprojection of the full bounds is going to be bigger than the sum of the
        // feature by feature reprojected bounds
        assertTrue(bounds.transform(target, true).contains((BoundingBox) rfc.getBounds()));

        // make sure that the reprojected bounds contain the target CRS
        assertEquals(target, rfc.getBounds().getCoordinateReferenceSystem());
    }
   
View Full Code Here

        // if there is a mismatch, reproject and replace
        if (crs != null && targetCrs != null && !CRS.equalsIgnoreMetadata(crs, targetCrs)) {
             ReferencedEnvelope envelope = ReferencedEnvelope.reference(boundaries);
             try {
        envelope = envelope.transform(targetCrs, true);
      } catch (TransformException e) {
        throw new RuntimeException (e);
      } catch (FactoryException e) {
        throw new RuntimeException (e);
      }
View Full Code Here

        if (isTransformRequired()) {
            CoordinateReferenceSystem layerCRS =
                    getLayer().getFeatureSource().getSchema().getCoordinateReferenceSystem();

            try {
                env = env.transform(layerCRS, true);
            } catch (Exception ex) {
                throw new IllegalStateException(ex);
            }
        }
View Full Code Here

        ReferencedEnvelope env = new ReferencedEnvelope(pos.x - radius, pos.x + radius, pos.y - radius, pos.y + radius,
                contextCRS);
        if (isTransformRequired()) {
            CoordinateReferenceSystem layerCRS = layerRef.get().getFeatureSource().getSchema().getCoordinateReferenceSystem();
            try {
                env = env.transform(layerCRS, true);
            } catch (Exception ex) {
                throw new IllegalStateException(ex);
            }
        }
View Full Code Here

    static public ReferencedEnvelope getWGS84ReferencedEnvelope(
        final GeneralEnvelope coverageEnvelope) {
      Utilities.ensureNonNull("coverageEnvelope", coverageEnvelope);
      final ReferencedEnvelope refEnv= new ReferencedEnvelope(coverageEnvelope);
      try{
          return refEnv.transform(DefaultGeographicCRS.WGS84, true);
      }catch (Exception e) {
                return null;
            }
    }
View Full Code Here

            CoordinateReferenceSystem targetCrs = findPropertyCRS(ff.property(propertyName));

            // if there is a mismatch, reproject and replace
            if (crs != null && targetCrs != null && !CRS.equalsIgnoreMetadata(crs, targetCrs)) {
                ReferencedEnvelope envelope = new ReferencedEnvelope(minx, maxx, miny, maxy, crs);
                envelope = envelope.transform(targetCrs, true);
                minx = envelope.getMinX();
                miny = envelope.getMinY();
                maxx = envelope.getMaxX();
                maxy = envelope.getMaxY();
               
View Full Code Here

                        // not, reproject the bbox
                        ReferencedEnvelope env = new ReferencedEnvelope(mapArea);
                        CoordinateReferenceSystem sourceCRS = gd.getCoordinateReferenceSystem();
                        if(sourceCRS != null &&
                            !CRS.equalsIgnoreMetadata(mapArea.getCoordinateReferenceSystem(), sourceCRS)) {
                            env = env.transform(sourceCRS, true);
                        }
                       
                        // build the mixed query
                        Filter original = query.getFilter();
                        Filter bbox = ff.bbox(gd.getLocalName(), env.getMinX(), env.getMinY(), env.getMaxX(), env.getMaxY(), null);
View Full Code Here

            // make sure we use the declared CRS, not the native one, the may differ
            if (!CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, declaredCRS)) {
                // transform
                try {
                    ReferencedEnvelope bounds = new ReferencedEnvelope(nativeBounds, declaredCRS);
                    return bounds.transform(DefaultGeographicCRS.WGS84, true);
                } catch (Exception e) {
                    throw (IOException) new IOException("transform error").initCause(e);
                }
            } else {
                return new ReferencedEnvelope(nativeBounds, DefaultGeographicCRS.WGS84);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.