| org.geotools.referencing.operation.transform.AbstractMathTransform org.geotools.referencing.operation.projection.MapProjection
All known Subclasses: org.geotools.referencing.operation.projection.Orthographic, org.geotools.referencing.operation.projection.Stereographic, org.geotools.referencing.operation.projection.ObliqueMercator, org.geotools.referencing.operation.projection.NewZealandMapGrid, org.geotools.referencing.operation.projection.AlbersEqualArea, org.geotools.referencing.operation.projection.LambertAzimuthalEqualArea, org.geotools.referencing.operation.projection.TransverseMercator, org.geotools.referencing.operation.projection.LambertConformal, org.geotools.referencing.operation.projection.Mercator, org.geotools.referencing.operation.projection.EquidistantCylindrical, org.geotools.referencing.operation.projection.Krovak,
MapProjection | abstract public class MapProjection extends AbstractMathTransform implements MathTransform2D,Serializable(Code) | | Base class for transformation services between ellipsoidal and cartographic projections.
This base class provides the basic feature needed for all methods (no need to overrides
methods). Subclasses must "only" implements the following methods:
NOTE:Serialization of this class is appropriate for short-term storage
or RMI use, but will probably not be compatible with future version. For long term storage,
WKT (Well Know Text) or XML (not yet implemented) are more appropriate.
since: 2.0 version: $Id: MapProjection.java 26518 2007-08-10 17:05:01Z desruisseaux $ author: André Gosselin author: Martin Desruisseaux author: Rueben Schulz See Also: Map projections on MathWorld See Also: Map projections on the atlas of Canada |
Method Summary | |
static boolean | checkInverseTransform(double longitude, double latitude, Point2D expected, double tolerance) Checks if inverse transform using spherical formulas produces the same result
than ellipsoidal formulas. | static boolean | checkInverseTransform(double longitude, double latitude, Point2D expected) Default version of
MapProjection.checkInverseTransform(double,double,Point2D,double) . | static boolean | checkTransform(double x, double y, Point2D expected, double tolerance) Checks if transform using spherical formulas produces the same result
than ellipsoidal formulas. | static boolean | checkTransform(double x, double y, Point2D expected) Default version of
MapProjection.checkTransform(double,double,Point2D,double) . | final double | cphi2(double ts) Iteratively solve equation (7-9) from Snyder. | final double | doubleValue(Collection expected, ParameterDescriptor param, ParameterValueGroup group) Returns the parameter value for the specified operation parameter. | static void | ensureLatitudeEquals(ParameterDescriptor name, double y, double expected) Ensures that the absolute value of a latitude is equals to the specified value, up to
the tolerance value. | static void | ensureLatitudeInRange(ParameterDescriptor name, double y, boolean edge) Ensures that the latitude is within allowed limits (±π/2). | static void | ensureLongitudeInRange(ParameterDescriptor name, double x, boolean edge) Ensures that the longitue is within allowed limits (±π). | final void | ensureSpherical() Ensures that this projection has equals semi-major and semi-minor axis. | public boolean | equals(Object object) Compares the specified object with this map projection for equality. | static boolean | equals(double value1, double value2) Returns
true if the two specified value are equals. | abstract public ParameterDescriptorGroup | getParameterDescriptors() Returns the parameter descriptors for this map projection. | public ParameterValueGroup | getParameterValues() Returns the parameter values for this map projection. | final public int | getSourceDimensions() Returns the dimension of input points. | final public int | getTargetDimensions() Returns the dimension of output points. | protected double | getToleranceForAssertions(double longitude, double latitude) Maximal error (in metres) tolerated for assertions, if enabled. | public int | hashCode() Returns a hash value for this map projection. | final public MathTransform | inverse() Returns the inverse of this map projection. | abstract protected Point2D | inverseTransformNormalized(double x, double y, Point2D ptDst) Transforms the specified coordinate and stores the result in
ptDst .
This method returns longitude as x values in the range
[-PI..PI] and latitude as y values in the range
[-PI/2..PI/2] . | boolean | isExpectedParameter(Collection expected, ParameterDescriptor param) Returns
true if the specified parameter can apply to this map projection.
The set of expected parameters must be supplied. | final double | msfn(double s, double c) Compute function f(s,c,e²) = c/sqrt(1 - s²×e²) needed for the true scale
latitude (Snyder 14-15), where s and c are the sine and cosine of
the true scale latitude, and e² is the
. | final void | set(Collection expected, ParameterDescriptor param, ParameterValueGroup group, double value) Set the value in a parameter group. | final public Point2D | transform(Point2D ptSrc, Point2D ptDst) Transforms the specified
ptSrc and stores the result in
ptDst .
This method standardizes the source
x coordinate
by removing the
MapProjection.centralMeridian , before invoking
MapProjection.transformNormalized transformNormalized (x, y, ptDst) .
It also multiplies by
MapProjection.globalScale and adds the
MapProjection.falseEasting and
MapProjection.falseNorthing to the point returned by the
transformNormalized(...) call.
Parameters: ptSrc - the specified coordinate point to be transformed.Ordinates must be in decimal degrees. Parameters: ptDst - the specified coordinate point that stores the result of transforming ptSrc , or null . | final public void | transform(double[] src, int srcOffset, double[] dest, int dstOffset, int numPts) Transforms a list of coordinate point ordinal values. | final public void | transform(float[] src, int srcOffset, float[] dest, int dstOffset, int numPts) Transforms a list of coordinate point ordinal values. | abstract protected Point2D | transformNormalized(double x, double y, Point2D ptDst) Transforms the specified coordinate and stores the result in
ptDst .
This method is guaranteed to be invoked with values of x in the range
[-PI..PI] and values of y in the range
[-PI/2..PI/2] .
Coordinates are also guaranteed to have the
MapProjection.centralMeridian
removed from x before this method is invoked. | final double | tsfn(double phi, double sinphi) Compute function (15-9) and (9-13) from Snyder. |
centralMeridian | protected double centralMeridian(Code) | | Central longitude in radians. Default value is 0, the Greenwich meridian.
This is called 'lambda0' in Snyder.
Consider this field as final. It is not final only
because some classes need to modify it at construction time.
|
falseEasting | final protected double falseEasting(Code) | | False easting, in metres. Default value is 0.
|
falseNorthing | final protected double falseNorthing(Code) | | False northing, in metres. Default value is 0.
|
globalScale | protected double globalScale(Code) | | Global scale factor. Default value
globalScale is equal
to
MapProjection.semiMajor ×
MapProjection.scaleFactor .
Consider this field as final. It is not final only
because some classes need to modify it at construction time.
|
latitudeOfOrigin | protected double latitudeOfOrigin(Code) | | Latitude of origin in radians. Default value is 0, the equator.
This is called 'phi0' in Snyder.
Consider this field as final. It is not final only
because some classes need to modify it at construction time.
|
scaleFactor | protected double scaleFactor(Code) | | The scale factor. Default value is 1. Named 'k' in Snyder.
Consider this field as final. It is not final only
because some classes need to modify it at construction time.
|
MapProjection | protected MapProjection(ParameterValueGroup values) throws ParameterNotFoundException(Code) | | Constructs a new map projection from the suplied parameters.
Parameters: values - The parameter values in standard units.The following parameter are recognized:- "semi_major" (mandatory: no default)
- "semi_minor" (mandatory: no default)
- "central_meridian" (default to 0°)
- "latitude_of_origin" (default to 0°)
- "scale_factor" (default to 1 )
- "false_easting" (default to 0 )
- "false_northing" (default to 0 )
throws: ParameterNotFoundException - if a mandatory parameter is missing. |
MapProjection | MapProjection(ParameterValueGroup values, Collection expected) throws ParameterNotFoundException(Code) | | Constructor invoked by sub-classes when we can't rely on
MapProjection.getParameterDescriptors before the construction
is completed. This is the case when the later method depends on
the value of some class's attribute, which has not yet been set.
An example is
Mercator.getParameterDescriptors .
This method is not public because it is not a very elegant hack, and
a work around exists. For example Mercator_1SP and Mercator_2SP could
be implemented by two separated classes, in which case
MapProjection.getParameterDescriptors returns a constant and can be safely invoked in a constructor. We do
not always use this cleaner way in the projection package because it
is going to contains a lot of.. well... projections, and we will try
to reduce the amount of class declarations.
|
checkInverseTransform | static boolean checkInverseTransform(double longitude, double latitude, Point2D expected, double tolerance)(Code) | | Checks if inverse transform using spherical formulas produces the same result
than ellipsoidal formulas. This method is invoked during assertions only.
Note: this method ignores the longitude if the latitude is
at a pole, because in such case the longitude is meanless.
Parameters: longitude - The longitude computed by spherical formulas, in radians. Parameters: latitude - The latitude computed by spherical formulas, in radians. Parameters: expected - The (longitude,latitude) computed by ellipsoidal formulas. Parameters: tolerance - The tolerance (optional). |
checkTransform | static boolean checkTransform(double x, double y, Point2D expected, double tolerance)(Code) | | Checks if transform using spherical formulas produces the same result
than ellipsoidal formulas. This method is invoked during assertions only.
Parameters: x - The easting computed by spherical formulas, in metres. Parameters: y - The northing computed by spherical formulas, in metres. Parameters: expected - The (easting,northing) computed by ellipsoidal formulas. Parameters: tolerance - The tolerance (optional). |
doubleValue | final double doubleValue(Collection expected, ParameterDescriptor param, ParameterValueGroup group) throws ParameterNotFoundException(Code) | | Returns the parameter value for the specified operation parameter. Values are
automatically converted into the standard units specified by the supplied
param argument, except
NonSI.DEGREE_ANGLE degrees which
are converted to
SI.RADIAN radians .
Parameters: expected - The value returned by getParameterDescriptors().descriptors() . Parameters: param - The parameter to look for. Parameters: group - The parameter value group to search into. The requested parameter value, or NaN if param isand the user didn't provided any value. throws: ParameterNotFoundException - if the parameter is not found. See Also: MathTransformProvider.doubleValue |
ensureLatitudeEquals | static void ensureLatitudeEquals(ParameterDescriptor name, double y, double expected) throws IllegalArgumentException(Code) | | Ensures that the absolute value of a latitude is equals to the specified value, up to
the tolerance value. The expected value is usually either
0 or
PI/2 (the equator or a pole).
Parameters: y - Latitude to check, in radians. Parameters: expected - The expected value, in radians. throws: IllegalArgumentException - if the latitude is not the expected one. |
ensureLatitudeInRange | static void ensureLatitudeInRange(ParameterDescriptor name, double y, boolean edge) throws IllegalArgumentException(Code) | | Ensures that the latitude is within allowed limits (±π/2).
This method is useful to check the validity of projection parameters,
like
MapProjection.latitudeOfOrigin .
Parameters: y - Latitude to check, in radians. Parameters: edge - true to accept latitudes of ±π/2. throws: IllegalArgumentException - if the latitude is out of range. |
ensureLongitudeInRange | static void ensureLongitudeInRange(ParameterDescriptor name, double x, boolean edge) throws IllegalArgumentException(Code) | | Ensures that the longitue is within allowed limits (±π).
This method is used to check the validity of projection parameters,
like
MapProjection.centralMeridian .
Parameters: x - Longitude to verify, in radians. Parameters: edge - true for accepting longitudes of ±π. throws: IllegalArgumentException - if the longitude is out of range. |
ensureSpherical | final void ensureSpherical() throws IllegalArgumentException(Code) | | Ensures that this projection has equals semi-major and semi-minor axis. This method is
invoked by constructors of classes implementing only spherical formulas.
|
equals | public boolean equals(Object object)(Code) | | Compares the specified object with this map projection for equality.
|
equals | static boolean equals(double value1, double value2)(Code) | | Returns
true if the two specified value are equals.
Two
Double.NaN NaN values are considered equals.
|
getParameterDescriptors | abstract public ParameterDescriptorGroup getParameterDescriptors()(Code) | | Returns the parameter descriptors for this map projection.
This is used for a providing a default implementation of
MapProjection.getParameterValues , as well as arguments checking.
|
getParameterValues | public ParameterValueGroup getParameterValues()(Code) | | Returns the parameter values for this map projection.
A copy of the parameter values for this map projection. |
getSourceDimensions | final public int getSourceDimensions()(Code) | | Returns the dimension of input points.
|
getTargetDimensions | final public int getTargetDimensions()(Code) | | Returns the dimension of output points.
|
getToleranceForAssertions | protected double getToleranceForAssertions(double longitude, double latitude)(Code) | | Maximal error (in metres) tolerated for assertions, if enabled. When assertions are enabled,
every direct projection is followed by an inverse projection, and the result is compared to
the original coordinate. If a distance greater than the tolerance level is found, then an
ProjectionException will be thrown. Subclasses should override this method if they
need to relax the tolerance level.
Parameters: longitude - The longitude in decimal degrees. Parameters: latitude - The latitude in decimal degrees. The tolerance level for assertions, in meters. |
hashCode | public int hashCode()(Code) | | Returns a hash value for this map projection.
|
inverse | final public MathTransform inverse()(Code) | | Returns the inverse of this map projection.
|
inverseTransformNormalized | abstract protected Point2D inverseTransformNormalized(double x, double y, Point2D ptDst) throws ProjectionException(Code) | | Transforms the specified coordinate and stores the result in
ptDst .
This method returns longitude as x values in the range
[-PI..PI] and latitude as y values in the range
[-PI/2..PI/2] . It will be
checked by the caller, so this method doesn't need to performs this check.
Input coordinates are also guarenteed to have the
MapProjection.falseEasting
and
MapProjection.falseNorthing removed and be divided by
MapProjection.globalScale before this method is invoked. After this method is invoked, the
MapProjection.centralMeridian is added to the
x results
in
ptDst . This means that projections that implement this method
are performed on an ellipse (or sphere) with a semiMajor axis of 1.0.
In PROJ.4, the same
standardization, described above, is handled by
pj_inv.c .
Therefore when porting projections from PROJ.4, the inverse transform
equations can be used directly here with minimal change.
In the equations of Snyder,
MapProjection.falseEasting ,
MapProjection.falseNorthing and
MapProjection.scaleFactor are usually not given.
When implementing these equations here, you will not
need to add the
MapProjection.centralMeridian to the output longitude or remove the
MapProjection.semiMajor ('a' or 'R').
Parameters: x - The easting of the coordinate, linear distance on a unit sphere or ellipse. Parameters: y - The northing of the coordinate, linear distance on a unit sphere or ellipse. Parameters: ptDst - the specified coordinate point that stores the result of transforming ptSrc , or null . Ordinates will be inradians. the coordinate point after transforming x , y and storing the result in ptDst . throws: ProjectionException - if the point can't be transformed. ptDst |
isExpectedParameter | boolean isExpectedParameter(Collection expected, ParameterDescriptor param)(Code) | | Returns
true if the specified parameter can apply to this map projection.
The set of expected parameters must be supplied. The default implementation just
invokes
expected.contains(param) . Some subclasses will override this method
in order to handle
ModifiedParameterDescriptor in a special way.
See Also: MapProjection.doubleValue See Also: MapProjection.set |
msfn | final double msfn(double s, double c)(Code) | | Compute function f(s,c,e²) = c/sqrt(1 - s²×e²) needed for the true scale
latitude (Snyder 14-15), where s and c are the sine and cosine of
the true scale latitude, and e² is the
.
|
set | final void set(Collection expected, ParameterDescriptor param, ParameterValueGroup group, double value)(Code) | | Set the value in a parameter group. This convenience method is used
by subclasses for
MapProjection.getParameterValues implementation. Values
are automatically converted from radians to decimal degrees if needed.
Parameters: expected - The value returned by getParameterDescriptors().descriptors() . Parameters: param - One of the AbstractProvider constants. Parameters: group - The group in which to set the value. Parameters: value - The value to set. |
transform | final public void transform(double[] src, int srcOffset, double[] dest, int dstOffset, int numPts) throws ProjectionException(Code) | | Transforms a list of coordinate point ordinal values. Ordinates must be
(longitude,latitude) pairs in decimal degrees.
throws: ProjectionException - if a point can't be transformed. This method tryto transform every points even if some of them can't be transformed.Non-transformable points will have value Double.NaN. If morethan one point can't be transformed, then this exception may be aboutan arbitrary point. |
transform | final public void transform(float[] src, int srcOffset, float[] dest, int dstOffset, int numPts) throws ProjectionException(Code) | | Transforms a list of coordinate point ordinal values. Ordinates must be
(longitude,latitude) pairs in decimal degrees.
throws: ProjectionException - if a point can't be transformed. This method tryto transform every points even if some of them can't be transformed.Non-transformable points will have value Float.NaN. If morethan one point can't be transformed, then this exception may be aboutan arbitrary point. |
transformNormalized | abstract protected Point2D transformNormalized(double x, double y, Point2D ptDst) throws ProjectionException(Code) | | Transforms the specified coordinate and stores the result in
ptDst .
This method is guaranteed to be invoked with values of x in the range
[-PI..PI] and values of y in the range
[-PI/2..PI/2] .
Coordinates are also guaranteed to have the
MapProjection.centralMeridian
removed from x before this method is invoked. After this method
is invoked, the results in
ptDst are multiplied by
MapProjection.globalScale ,
and the
MapProjection.falseEasting and
MapProjection.falseNorthing are added.
This means that projections that implement this method are performed on an
ellipse (or sphere) with a semiMajor axis of 1.0.
In PROJ.4, the same
standardization, described above, is handled by
pj_fwd.c .
Therefore when porting projections from PROJ.4, the forward transform equations can
be used directly here with minimal change. In the equations of Snyder,
MapProjection.falseEasting ,
MapProjection.falseNorthing and
MapProjection.scaleFactor are usually not given. When implementing these equations here, you will not
need to remove the
MapProjection.centralMeridian from x or apply the
MapProjection.semiMajor ('a' or 'R').
Parameters: x - The longitude of the coordinate, in radians. Parameters: y - The latitude of the coordinate, in radians. Parameters: ptDst - the specified coordinate point that stores the result of transforming ptSrc , or null . Ordinates will be in adimensionless unit, as a linear distance on a unit sphere or ellipse. the coordinate point after transforming x , y and storing the result in ptDst . throws: ProjectionException - if the point can't be transformed. ptDst |
tsfn | final double tsfn(double phi, double sinphi)(Code) | | Compute function (15-9) and (9-13) from Snyder.
Equivalent to negative of function (7-7).
|
Methods inherited from org.geotools.referencing.operation.transform.AbstractMathTransform | public Shape createTransformedShape(Shape shape) throws TransformException(Code)(Java Doc) public Matrix derivative(Point2D point) throws TransformException(Code)(Java Doc) public Matrix derivative(DirectPosition point) throws TransformException(Code)(Java Doc) protected static void ensureNonNull(String name, Object object) throws IllegalArgumentException(Code)(Java Doc) public boolean equals(Object object)(Code)(Java Doc) protected String formatWKT(Formatter formatter)(Code)(Java Doc) public ParameterDescriptorGroup getParameterDescriptors()(Code)(Java Doc) public ParameterValueGroup getParameterValues()(Code)(Java Doc) abstract public int getSourceDimensions()(Code)(Java Doc) abstract public int getTargetDimensions()(Code)(Java Doc) public int hashCode()(Code)(Java Doc) public MathTransform inverse() throws NoninvertibleTransformException(Code)(Java Doc) public boolean isIdentity()(Code)(Java Doc) protected static boolean needCopy(int srcOff, int dimSource, int dstOff, int dimTarget, int numPts)(Code)(Java Doc) protected static double rollLongitude(double x)(Code)(Java Doc) public Point2D transform(Point2D ptSrc, Point2D ptDst) throws TransformException(Code)(Java Doc) public DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst) throws TransformException(Code)(Java Doc) public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException(Code)(Java Doc)
|
|
|