/** * Creates the inverse CoordinateOperation. * @return * @throws org.cts.op.NonInvertibleOperationException */ @Override public CoordinateOperation inverse() throws NonInvertibleOperationException { CoordinateOperation[] inverse_sequence = new CoordinateOperation[sequence.length]; for (int i = 0; i < sequence.length; i++) { // If one of the CoordinateOperation is not invertible, it // will throw a NonInvertibleOperationException. inverse_sequence[sequence.length - i - 1] = sequence[i].inverse(); //if (inverse_sequence[sequence.length-i-1] == null) return null; } return new CoordinateOperationSequence(getIdentifier(), inverse_sequence, precision); }
/** * Adds a CoordinateOperation to the list of CoordinateOperations usable to transform * coordinates from source CRS to target CRS. * parameter. This CoordinateOperation links a source * {@link org.cts.crs.GeodeticCRS} to a target {@link org.cts.crs.GeodeticCRS} using the * same {@link org.cts.datum.GeodeticDatum}. * Remember that {@link org.cts.crs.GeodeticCRS}s include {@link org.cts.crs.GeocentricCRS}s, * {@link org.cts.crs.Geographic2DCRS}s, {@link org.cts.crs.Geographic3DCRS}s and * {@link org.cts.crs.ProjectedCRS}s. * * @param source the source geodetic coordinate reference system * @param target the target geodetic coordinate reference system * @param opList the list in which the CoordinateOperation must be added */ private static void addCoordinateOperations( GeodeticCRS source, GeodeticCRS target, Set<CoordinateOperation> opList) throws CoordinateOperationException { try { opList.add(new CoordinateOperationSequence( new Identifier(CoordinateOperationSequence.class, source.getCode() + " to " + target.getCode()), source.toGeographicCoordinateConverter(), target.fromGeographicCoordinateConverter())); } catch (NonInvertibleOperationException e) { LOG.warn("Operation from " + source.getCode() + " to " + target.getCode() + " could not be created"); LOG.error("CoordinateOperationFactory", e); } }
/** * @return * @throws org.cts.op.NonInvertibleOperationException * @see GeodeticCRS#fromGeographicCoordinateConverter() */ @Override public CoordinateOperation fromGeographicCoordinateConverter() throws NonInvertibleOperationException { List<CoordinateOperation> ops = new ArrayList<CoordinateOperation>(); if (!getDatum().getPrimeMeridian().equals(PrimeMeridian.GREENWICH)) { ops.add(LongitudeRotation.getLongitudeRotationFrom(getDatum().getPrimeMeridian())); } ops.add(new Geographic2Geocentric(getDatum().getEllipsoid())); return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops); }
/** * @return * @throws org.cts.op.NonInvertibleOperationException * @see GeodeticCRS#toGeographicCoordinateConverter() */ @Override public CoordinateOperation toGeographicCoordinateConverter() throws NonInvertibleOperationException { List<CoordinateOperation> ops = new ArrayList<CoordinateOperation>(); ops.add(new Geocentric2Geographic(getDatum().getEllipsoid())); if (!getDatum().getPrimeMeridian().equals(PrimeMeridian.GREENWICH)) { ops.add(LongitudeRotation.getLongitudeRotationTo(getDatum().getPrimeMeridian())); } return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops); }
/** * @return * @see GeodeticCRS#toGeographicCoordinateConverter() */ @Override public CoordinateOperation toGeographicCoordinateConverter() { List<CoordinateOperation> ops = new ArrayList<CoordinateOperation>(); for (int i = 0; i < 2; i++) { if (getCoordinateSystem().getAxis(i).getDirection() == SOUTH || getCoordinateSystem().getAxis(i).getDirection() == WEST) { ops.add(new OppositeCoordinate(i)); } } // Convert from source unit to radians ops.add(UnitConversion.createUnitConverter(getCoordinateSystem().getUnit(0), RADIAN)); // switch from LON/LAT to LAT/LON coordinate if necessary if (getCoordinateSystem().getAxis(0).getDirection() == EAST || getCoordinateSystem().getAxis(0).getDirection() == WEST) { ops.add(CoordinateSwitch.SWITCH_LAT_LON); } // Add a third value to transform the geographic2D coord into a // geographic3D coord ops.add(ChangeCoordinateDimension.TO3D); return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops); }
/** * @return * @see GeodeticCRS#fromGeographicCoordinateConverter() */ @Override public CoordinateOperation fromGeographicCoordinateConverter() { List<CoordinateOperation> ops = new ArrayList<CoordinateOperation>(); // Remove the third value to transform the geographic3D coord into a // geographic2D coord ops.add(ChangeCoordinateDimension.TO2D); // switch from LON/LAT to LAT/LON coordinate if necessary if (getCoordinateSystem().getAxis(0).getDirection() == EAST || getCoordinateSystem().getAxis(0).getDirection() == WEST) { ops.add(CoordinateSwitch.SWITCH_LAT_LON); } // Convert from radian to this coordinate system's units ops.add(UnitConversion.createUnitConverter(RADIAN, getCoordinateSystem().getUnit(0))); for (int i = 0; i < 2; i++) { if (getCoordinateSystem().getAxis(i).getDirection() == SOUTH || getCoordinateSystem().getAxis(i).getDirection() == WEST) { ops.add(new OppositeCoordinate(i)); } } return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops); }
/** * @return * @see GeodeticCRS#fromGeographicCoordinateConverter() */ @Override public CoordinateOperation fromGeographicCoordinateConverter() { List<CoordinateOperation> ops = new ArrayList<CoordinateOperation>(); // Remove the third value to transform the geographic3D coord into a // geographic2D coord ops.add(ChangeCoordinateDimension.TO2D); // Projection ops.add(projection); // switch easting/northing coordinate if necessary if (getCoordinateSystem().getAxis(0).getDirection() == NORTH || getCoordinateSystem().getAxis(0).getDirection() == SOUTH) { ops.add(CoordinateSwitch.SWITCH_LAT_LON); } // Unit conversion if (getCoordinateSystem().getUnit(0) != METER) { ops.add(UnitConversion.createUnitConverter(METER, getCoordinateSystem().getUnit(0))); } for (int i = 0; i < 2; i++) { if (getCoordinateSystem().getAxis(i).getDirection() == SOUTH || getCoordinateSystem().getAxis(i).getDirection() == WEST) { ops.add(new OppositeCoordinate(i)); } } return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops); }
return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops);
ntf_r93.loadGridShiftFile(); crs.getDatum().addGeographicTransformation(GeodeticDatum.WGS84, new CoordinateOperationSequence(ntf_r93.getIdentifier(), LongitudeRotation.getLongitudeRotationFrom(crs.getDatum().getPrimeMeridian()), ntf_r93)); crs.getDatum().addGeographicTransformation(GeodeticDatum.RGF93, new CoordinateOperationSequence(ntf_r93.getIdentifier(), LongitudeRotation.getLongitudeRotationFrom(crs.getDatum().getPrimeMeridian()), ntf_r93)); LOGGER.info("Add NTv2 transformation from " + crs.getDatum() + " to RGF93 and WGS84"); GeodeticDatum datum = GeodeticDatum.getGeodeticDatum(gt.getToDatum()); crs.getDatum().addGeographicTransformation(datum, new CoordinateOperationSequence( gt.getIdentifier(), new LongitudeRotation(crs.getDatum().getPrimeMeridian().getLongitudeFromGreenwichInRadians()),
cos = new CoordinateOperationSequence( new Identifier(CoordinateOperationSequence.class, "Geographic Transformation from " + this.getShortName() + " to " + targetDatum.getShortName()), cos = new CoordinateOperationSequence( new Identifier(CoordinateOperationSequence.class, "Geographic Transformation from " + this.getShortName() + " to " + targetDatum.getShortName()),
/** * @return * @see GeodeticCRS#fromGeographicCoordinateConverter() */ @Override public CoordinateOperation fromGeographicCoordinateConverter() { List<CoordinateOperation> ops = new ArrayList<CoordinateOperation>(); // switch from LON/LAT to LAT/LON coordinate if necessary if (getCoordinateSystem().getAxis(0).getDirection() == EAST || getCoordinateSystem().getAxis(0).getDirection() == WEST) { ops.add(CoordinateSwitch.SWITCH_LAT_LON); } // Convert from radian to this coordinate system's units ops.add(UnitConversion.createUnitConverter(RADIAN, getCoordinateSystem().getUnit(0), METER, getCoordinateSystem().getUnit(2))); for (int i = 0; i < 3; i++) { if (getCoordinateSystem().getAxis(i).getDirection() == SOUTH || getCoordinateSystem().getAxis(i).getDirection() == WEST || getCoordinateSystem().getAxis(i).getDirection() == DOWN) { ops.add(new OppositeCoordinate(i)); } } return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops); }
/** * @return * @see GeodeticCRS#toGeographicCoordinateConverter() */ @Override public CoordinateOperation toGeographicCoordinateConverter() { List<CoordinateOperation> ops = new ArrayList<CoordinateOperation>(); for (int i = 0; i < 3; i++) { if (getCoordinateSystem().getAxis(i).getDirection() == SOUTH || getCoordinateSystem().getAxis(i).getDirection() == WEST || getCoordinateSystem().getAxis(i).getDirection() == DOWN) { ops.add(new OppositeCoordinate(i)); } } // Convert from source unit to radians ops.add(UnitConversion.createUnitConverter(getCoordinateSystem().getUnit(0), RADIAN, getCoordinateSystem().getUnit(2), METER)); // switch from LON/LAT to LAT/LON coordinate if necessary if (getCoordinateSystem().getAxis(0).getDirection() == EAST || getCoordinateSystem().getAxis(0).getDirection() == WEST) { ops.add(CoordinateSwitch.SWITCH_LAT_LON); } return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops); }
throw new CoordinateOperationNotFoundException("Unknown vertical datum type for this CRS : " + this); return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops);
for (CoordinateOperation datumTf : datumTransformations) { try { opList.add(new CoordinateOperationSequence( new Identifier(CoordinateOperationSequence.class, source.getCode() + " to " + target.getCode() + " through " + datumTf.getName()),
return new CoordinateOperationSequence(new Identifier( CoordinateOperationSequence.class), ops);