Package org.geotools.geometry.jts

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


                    // 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

                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);
                aggregatedBounds.expandToInclude(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

                           else {
                               // use native bbox
                               b = r.getNativeBoundingBox();
                               if (bbox != null) {
                                   // transform
                                   b = b.transform(bbox.getCoordinateReferenceSystem(), true);
                               }
                           }
   
                           if (bbox != null) {
                               bbox.include(b);
View Full Code Here

        }
        LayerGroupInfo lgi = (LayerGroupInfo) info;
        ReferencedEnvelope latLonBoundingBox;
        latLonBoundingBox = lgi.getBounds();
        try {
            latLonBoundingBox = latLonBoundingBox.transform(DefaultGeographicCRS.WGS84, true);
        } catch (Exception e) {
            LOGGER.log(Level.INFO, "Error transforming " + lgi.getName()
                    + " LayerGroup's bounds to EPSG:4326", e);
            latLonBoundingBox = new ReferencedEnvelope(DefaultGeographicCRS.WGS84);
            try {
View Full Code Here

                    + " LayerGroup's bounds to EPSG:4326", e);
            latLonBoundingBox = new ReferencedEnvelope(DefaultGeographicCRS.WGS84);
            try {
                for (LayerInfo li : lgi.layers()) {
                    ReferencedEnvelope llbb = li.getResource().getLatLonBoundingBox();
                    latLonBoundingBox.expandToInclude(llbb.transform(DefaultGeographicCRS.WGS84,
                            true));
                }
            } catch (Exception e2) {
                throw new RuntimeException(e2);
            }
View Full Code Here

                    if (handler != null) {
                        ReferencedEnvelope validArea = handler.getValidAreaBounds();
                        Envelope intersection = validArea.intersection(ReferencedEnvelope
                                .reference(reader.getOriginalEnvelope()));
                        ReferencedEnvelope re = new ReferencedEnvelope(intersection, sourceCRS);
                        sourceEnvelopeInSubsettingCRS = new WCSEnvelope(re.transform(subsettingCRS,
                                true));
                    } else {
                        throw new WCS20Exception("Unable to initialize subsetting envelope",
                                WCS20Exception.WCS20ExceptionCode.SubsettingCrsNotSupported,
                                subsettingCRS.toWKT(), e); // TODO extract code
View Full Code Here

        ResourceInfo r = task.getLayer().getResource();
        if (force || r.getLatLonBoundingBox() == null && r.getNativeBoundingBox() != null) {
            CoordinateReferenceSystem nativeCRS = CRS.decode(r.getSRS());
            ReferencedEnvelope nativeBbox =
                new ReferencedEnvelope(r.getNativeBoundingBox(), nativeCRS);
            r.setLatLonBoundingBox(nativeBbox.transform(CRS.decode("EPSG:4326"), true));
            return true;
        }
        return false;
    }
View Full Code Here

            ReferencedEnvelope ref = null;
            // Reproject back to requested SRS if we have to
            if (!useNativeBounds && !reqSRS.equalsIgnoreCase(SRS)) {
                try {
                    ref = new ReferencedEnvelope(aggregateBbox, CRS.decode("EPSG:4326"));
                    aggregateBbox = ref.transform(reqCRS, true);
                } catch (ProjectionException pe) {
                    ref.expandBy(-1 * ref.getWidth() / 50, -1 * ref.getHeight() / 50);
                    try {
                        aggregateBbox = ref.transform(reqCRS, true);
                    } catch (FactoryException e) {
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.