Package org.geotools.geometry.jts

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


          Envelope envelope = new Envelope(ogEnvelope.getLowerCorner().getCoordinate()[0], ogEnvelope
              .getUpperCorner().getCoordinate()[0], ogEnvelope.getLowerCorner().getCoordinate()[1],
              ogEnvelope.getUpperCorner().getCoordinate()[1]);
          log.info("CRS " + targetCrs.getId() + " envelope " + envelope);
          ReferencedEnvelope refEnvelope = new ReferencedEnvelope(envelope, targetCrs);
          transformableArea = refEnvelope.transform(sourceCrs, true);
          log.info("transformable area for " + key + " is " + transformableArea);
        }
      } catch (MismatchedDimensionException mde) {
        log.warn("Cannot build transformableArea for CRS transformation between " + sourceCrs.getId() + " and "
            + targetCrs.getId() + ", " + mde.getMessage());
View Full Code Here


        }
        if (envelope.isNull()) {
          return new Bbox();
        } else {
          ReferencedEnvelope refEnvelope = new ReferencedEnvelope(envelope, crsTransform.getSource());
          envelope = refEnvelope.transform(crsTransform.getTarget(), true);
          return new Bbox(envelope.getMinX(), envelope.getMinY(), envelope.getWidth(), envelope.getHeight());
        }
      } else {
        return source;
      }
View Full Code Here

        }
        if (source.isNull()) {
          return source;
        } else {
          ReferencedEnvelope refEnvelope = new ReferencedEnvelope(source, crsTransform.getSource());
          return refEnvelope.transform(crsTransform.getTarget(), true);
        }
      } else {
        return source;
      }
    } catch (Exception e) { // typically TopologyException, TransformException or FactoryException, but be safe
View Full Code Here

                Object obj = editor.getEditorInput();
                Class mapType = obj.getClass();
                Method get = mapType.getMethod("getExtent" ); //$NON-NLS-1$
                Object value = get.invoke( obj );
                ReferencedEnvelope world = (ReferencedEnvelope) value;               
                filter.bbox = world.transform( DefaultGeographicCRS.WGS84, true);
            }
            catch( Throwable t ) {
                LocationUIPlugin.log( "ha ha", t ); //$NON-NLS-1$
            }           
        }
View Full Code Here

                } else if (ext instanceof GeographicBoundingBox) {
                    GeographicBoundingBox gbb = (GeographicBoundingBox) ext;
                    ReferencedEnvelope env = new ReferencedEnvelope(DefaultGeographicCRS.WGS84);
                    env.expandToInclude(gbb.getWestBoundLongitude(), gbb.getNorthBoundLatitude());
                    env.expandToInclude(gbb.getEastBoundLongitude(), gbb.getSouthBoundLatitude());
                    env = env.transform(crs, true);
                    if (env.getMinX() < xmin)
                        xmin = env.getMinX();
                    if (env.getMaxX() > xmax)
                        xmax = env.getMaxX();
                    if (env.getMinY() < ymin)
View Full Code Here

        // fall back to WGS84 bounds and transform to world CRS
                GeographicBoundingBox worldBounds = CRS.getGeographicBoundingBox(worldCRS);
                if( worldBounds != null ){
                    ReferencedEnvelope testGeo = new ReferencedEnvelope(worldBounds.getWestBoundLongitude(), worldBounds.getEastBoundLongitude(), worldBounds.getNorthBoundLatitude(), worldBounds.getSouthBoundLatitude(), DefaultGeographicCRS.WGS84);
                    try {
                        extent = testGeo.transform(worldCRS,  true );
                    } catch (TransformException e) {
                        extent = null; // off the map!
                    } catch (FactoryException e) {
                        extent = null; // off the map!
                    }
View Full Code Here

        Geometry geometry = (Geometry) currentFeature.getDefaultGeometry();
        Envelope envelope = geometry.getEnvelopeInternal();
        envelope.expandBy(zoomBuffer);
        ReferencedEnvelope ref = new ReferencedEnvelope(envelope, crs);
        try {
            ref = ref.transform(activeMap.getViewportModel().getCRS(), true);
        } catch (Exception e1) {
            // ignore
        }

        UndoableMapCommand selectCommand = SelectionCommandFactory.getInstance().createFIDSelectCommand(selectedLayer,
View Full Code Here

        // calculate the size of the image and where it will be in the display
        Envelope envelope;
        try{
            ReferencedEnvelope bounds = new ReferencedEnvelope(feature.getBounds());
            envelope = bounds.transform(getMap().getViewportModel().getCRS(), true);
        }catch (Exception e) {
            envelope=new ReferencedEnvelope(feature.getBounds());
        }
        double[] screenbounds=new double[]{
                envelope.getMinX(), envelope.getMinY(),
View Full Code Here

        if (result != null && !result.isNull()) {
            DefaultEngineeringCRS generic2d = DefaultEngineeringCRS.GENERIC_2D;
            if (crs != null && result.getCoordinateReferenceSystem() != generic2d) {
                try {
                    result = result.transform(crs, true);
                } catch (Exception fe) {
                    ProjectPlugin.log("failure to transform layer bounds", fe); //$NON-NLS-1$
                }
            }
        } else {
View Full Code Here

        }
      }

      latLong.translate(deltax, deltay);

      return latLong.transform(
          pixelBounds.getCoordinateReferenceSystem(), true);
    } catch (TransformException e) {
      ProjectPlugin.log("", e);
    } catch (FactoryException e) {
      ProjectPlugin.log("", 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.