Package org.geotools.geometry.jts

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


          }
      }
     
      if ( !CRS.equalsIgnoreMetadata(declaredCRS, nativeCRS) &&
          php == ProjectionPolicy.REPROJECT_TO_DECLARED ) {
          return nativeBox.transform(declaredCRS,true);
      } else if(php == ProjectionPolicy.FORCE_DECLARED) {
        return ReferencedEnvelope.create( (Envelope) nativeBox, declaredCRS);
      }
     
      return nativeBox;
View Full Code Here


                CoordinateReferenceSystem sourceCrs = schema.getGeometryDescriptor().getCoordinateReferenceSystem();

                boolean reproject = (sourceCrs != null)
                && !CRS.equalsIgnoreMetadata(aoi.getCoordinateReferenceSystem(), sourceCrs);
                if (reproject) {
                    aoi = aoi.transform(sourceCrs, true);
                }
              // apply filters.
                // 1) bbox filter
                BBOX bboxFilter = filterFactory.bbox(schema.getGeometryDescriptor().getLocalName(),
                        aoi.getMinX() , aoi.getMinY(), aoi.getMaxX(), aoi.getMaxY(), null);
View Full Code Here

            LookAtDecoratorFactory lookAtFactory = new LookAtDecoratorFactory();
            ReferencedEnvelope layerBounds = layer.getBounds();
            CoordinateReferenceSystem layerCRS = layerBounds.getCoordinateReferenceSystem();
            if(layerCRS != null && !CRS.equalsIgnoreMetadata(layerCRS, DefaultGeographicCRS.WGS84)) {
                try {
                    layerBounds = layerBounds.transform(DefaultGeographicCRS.WGS84, true);
                } catch(Exception e) {
                    throw new ServiceException("Failed to transform the layer bounds for "
                            + layer.getTitle() + " to WGS84", e);
                }
            }
View Full Code Here

                    // there is some overlap, let's try the reprojection again.
                    // if even this fails, the user has evidently setup the
                    // geographics bounds improperly
                    ReferencedEnvelope refRed = new ReferencedEnvelope(reduced,
                            tile.getEnvelope().getCoordinateReferenceSystem());
                    nativeTileEnvelope = refRed.transform(nativeCrs, true);
                }
            } else {
                nativeTileEnvelope = tile.getEnvelope();
            }
View Full Code Here

            boolean reprojectBBox = (box.getCoordinateReferenceSystem() != null)
                    && !CRS.equalsIgnoreMetadata(box.getCoordinateReferenceSystem(),
                            DefaultGeographicCRS.WGS84);
            if (reprojectBBox) {
                try {
                    box = box.transform(DefaultGeographicCRS.WGS84, true);
                } catch (Exception e) {
                    throw new ServiceException("Could not transform bbox to WGS84", e,
                            "ReprojectionError", "");
                }
            }
View Full Code Here

        int numStyles = 1/* default */+ tileLayer.getInfo().cachedStyles().size();
        final int expected = numGridsets * numFormats * numStyles;
        verify(tileBreeder, times(expected)).dispatchTasks(any(GWCTask[].class));

        reset(tileBreeder);
        bounds = bounds.transform(CRS.decode("EPSG:900913"), true);
        mediator.truncate(layerName, bounds);
        verify(tileBreeder, times(expected)).dispatchTasks(any(GWCTask[].class));

        reset(tileBreeder);
        bounds = mediator.getAreaOfValidity(CRS.decode("EPSG:2083"));// Terra del Fuego
View Full Code Here

            final MapLayerInfo layerInfo = layerInfos.get(i);

            ReferencedEnvelope layerLatLongBbox;
            layerLatLongBbox = computeLayerBounds(Layer, layerInfo, computeQueryBounds);
            try {
                layerLatLongBbox = layerLatLongBbox.transform(
                        aggregatedBounds.getCoordinateReferenceSystem(), true);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            target.add(layerLatLongBbox);
View Full Code Here

            FeatureSource featureSource = layer.getFeatureSource();
            try {
                CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
                FeatureCollection features = featureSource.getFeatures(layerQuery);
                layerLatLongBbox = features.getBounds();
                layerLatLongBbox = layerLatLongBbox.transform(targetCRS, true);
            } catch (Exception e) {
                LOGGER.info("Error computing bounds for " + featureSource.getName() + " with "
                        + layerQuery);
            }
View Full Code Here

    @Test
    public void testBoundsCRS() throws Exception {
        CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:32628", true);
        ReferencedEnvelope nestedExpected = aggregateEnvelopes(forestLayer, roadSegmentsLayer,
                lakesLayer, neatlineLayer, buildingsLayer, pondsLayer);
        nestedExpected = nestedExpected.transform(targetCRS, true);
        new LayerGroupHelper(nested).calculateBounds(targetCRS);
        assertEquals(nestedExpected, nested.getBounds());
    }

    private ReferencedEnvelope aggregateEnvelopes(LayerInfo... layers) {
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.