Package org.geotools.geometry.jts

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


            assert requestBBox.getCoordinateReferenceSystem().equals(requestCRS);

            if (requestBBox.getCoordinateReferenceSystem().equals(viewportCRS)) {
                backprojectedBBox = (Envelope) requestBBox;
            } else {
                backprojectedBBox = (Envelope) requestBBox.transform(viewportCRS, true);
            }

            if (WMSPlugin.isDebugging(Trace.RENDER)) {
                WMSPlugin.trace("Viewport CRS: " + viewportCRS.getName()); //$NON-NLS-1$
                WMSPlugin.trace("Request CRS: " + requestCRS.getName()); //$NON-NLS-1$
View Full Code Here


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

                            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) {
                        e.printStackTrace();
                    } catch (TransformException e) {
                        e.printStackTrace();
                    }
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

                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

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

        boolean reprojectBBox = (sourceCrs != null)
                && !CRS.equalsIgnoreMetadata(
                        aoi.getCoordinateReferenceSystem(), sourceCrs);
        if (reprojectBBox) {
            aoi = aoi.transform(sourceCrs, true);
        }

        Filter filter = createBBoxFilter(schema, aoi);

        // now build the query using only the attributes and the bounding
View Full Code Here

                Filter filter = null;

                //ReferencedEnvelope aoi = mapContext.getAreaOfInterest();
                if (!CRS.equalsIgnoreMetadata(aoi.getCoordinateReferenceSystem(),
                            schema.getCoordinateReferenceSystem())) {
                    aoi = aoi.transform(schema.getCoordinateReferenceSystem(), true);
                }

                filter = createBBoxFilters(schema, attributes, aoi);

                // now build the query using only the attributes and the bounding
View Full Code Here

            ReferencedEnvelope box = new ReferencedEnvelope(mapContext.getAreaOfInterest());
            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 WmsException("Could not transform bbox to WGS84", "ReprojectionError", e);
                }
            }
            start("LatLonBox");
View Full Code Here

                            AbstractGridCoverage2DReader reader = (AbstractGridCoverage2DReader) cinfo.getGridCoverageReader(null, null);
                            bounds = new ReferencedEnvelope(reader.getOriginalEnvelope());
                            // apply the bounds, taking into account the reprojection policy if need be
                            if (resourceInfo.getProjectionPolicy() == ProjectionPolicy.REPROJECT_TO_DECLARED && bounds != null) {
                                try {
                                    bounds = bounds.transform(resourceInfo.getCRS(), true);
                                    GridGeometry grid = ((CoverageInfo) resourceInfo).getGrid();
                                    ((CoverageInfo) resourceInfo).setGrid(new GridGeometry2D(grid.getGridRange(),grid.getGridToCRS(), resourceInfo.getCRS()));
                                } catch(Exception e) {
                                    throw (IOException) new IOException("transform error").initCause(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.