Package org.locationtech.proj4j
Class BasicCoordinateTransform
- java.lang.Object
-
- org.locationtech.proj4j.BasicCoordinateTransform
-
- All Implemented Interfaces:
java.io.Serializable
,CoordinateTransform
public class BasicCoordinateTransform extends java.lang.Object implements CoordinateTransform
Represents the operation of transforming aProjCoordinate
from oneCoordinateReferenceSystem
into a different one, using reprojection and datum conversion as required.Computing the transform involves the following steps:
- If the source coordinate is in a projected coordinate system, it is inverse-projected into a geographic coordinate system based on the source datum
- If the source and target
Datum
s are different, the source geographic coordinate is converted from the source to the target datum as accurately as possible - If the target coordinate system is a projected coordinate system, the converted geographic coordinate is projected into a projected coordinate.
[ SrcProjCRS {InverseProjection} ] SrcGeoCRS [ {Datum Conversion} ] TgtGeoCRS [ {Projection} TgtProjCRS ]
Information about the transformation procedure is pre-computed and cached in this object for efficient computation.
- See Also:
CoordinateTransformFactory
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
doDatumTransform
private boolean
doForwardProjection
private boolean
doInverseProjection
private CoordinateReferenceSystem
srcCRS
private GeocentricConverter
srcGeoConv
private CoordinateReferenceSystem
tgtCRS
private GeocentricConverter
tgtGeoConv
private boolean
transformViaGeocentric
-
Constructor Summary
Constructors Constructor Description BasicCoordinateTransform(CoordinateReferenceSystem srcCRS, CoordinateReferenceSystem tgtCRS)
Creates a transformation from a sourceCoordinateReferenceSystem
to a target one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
datumTransform(ProjCoordinate pt)
Input: long/lat/z coordinates in radians in the source datum Output: long/lat/z coordinates in radians in the target datumCoordinateReferenceSystem
getSourceCRS()
CoordinateReferenceSystem
getTargetCRS()
ProjCoordinate
transform(ProjCoordinate src, ProjCoordinate tgt)
Transforms a coordinate from the sourceCoordinateReferenceSystem
to the target one.
-
-
-
Field Detail
-
srcCRS
private final CoordinateReferenceSystem srcCRS
-
tgtCRS
private final CoordinateReferenceSystem tgtCRS
-
doInverseProjection
private final boolean doInverseProjection
-
doForwardProjection
private final boolean doForwardProjection
-
doDatumTransform
private final boolean doDatumTransform
-
transformViaGeocentric
private final boolean transformViaGeocentric
-
srcGeoConv
private GeocentricConverter srcGeoConv
-
tgtGeoConv
private GeocentricConverter tgtGeoConv
-
-
Constructor Detail
-
BasicCoordinateTransform
public BasicCoordinateTransform(CoordinateReferenceSystem srcCRS, CoordinateReferenceSystem tgtCRS)
Creates a transformation from a sourceCoordinateReferenceSystem
to a target one.- Parameters:
srcCRS
- the source CRS to transform fromtgtCRS
- the target CRS to transform to
-
-
Method Detail
-
getSourceCRS
public CoordinateReferenceSystem getSourceCRS()
- Specified by:
getSourceCRS
in interfaceCoordinateTransform
-
getTargetCRS
public CoordinateReferenceSystem getTargetCRS()
- Specified by:
getTargetCRS
in interfaceCoordinateTransform
-
transform
public ProjCoordinate transform(ProjCoordinate src, ProjCoordinate tgt) throws Proj4jException
Transforms a coordinate from the sourceCoordinateReferenceSystem
to the target one.- Specified by:
transform
in interfaceCoordinateTransform
- Parameters:
src
- the input coordinate to be transformedtgt
- the transformed coordinate- Returns:
- the target coordinate which was passed in
- Throws:
Proj4jException
- if a computation error is encountered
-
datumTransform
private void datumTransform(ProjCoordinate pt)
Input: long/lat/z coordinates in radians in the source datum Output: long/lat/z coordinates in radians in the target datum- Parameters:
pt
- the point containing the input and output values
-
-