Class Mercator

  • All Implemented Interfaces:
    Serializable, MathTransform, MathTransform2D
    Direct Known Subclasses:
    Mercator1SP, Mercator2SP

    public abstract class Mercator
    extends MapProjection
    Mercator Cylindrical Projection. The parallels and the meridians are straight lines and cross at right angles; this projection thus produces rectangular charts. The scale is true along the equator (by default) or along two parallels equidistant of the equator (if a scale factor other than 1 is used). This projection is used to represent areas close to the equator. It is also often used for maritime navigation because all the straight lines on the chart are loxodrome lines, i.e. a ship following this line would keep a constant azimuth on its compass.

    This implementation handles both the 1 and 2 stardard parallel cases. For Mercator_1SP (EPSG code 9804), the line of contact is the equator. For Mercator_2SP (EPSG code 9805) lines of contact are symmetrical about the equator.

    References:

    • John P. Snyder (Map Projections - A Working Manual,
      U.S. Geological Survey Professional Paper 1395, 1987)
    • "Coordinate Conversions and Transformations including Formulas",
      EPSG Guidence Note Number 7, Version 19.
    Since:
    2.1
    Author:
    André Gosselin, Martin Desruisseaux (PMO, IRD), Rueben Schulz, Simone Giannecchini
    See Also:
    Mercator projection on MathWorld, "mercator_1sp" on RemoteSensing.org, "mercator_2sp" on RemoteSensing.org, Serialized Form
    • Field Detail

      • standardParallel

        protected final double standardParallel
        Standard Parallel used for the Mercator2SP case. Set to Double.NaN for the Mercator1SP case.
    • Method Detail

      • transformNormalized

        protected Point2D transformNormalized​(double x,
                                              double y,
                                              Point2D ptDst)
                                       throws ProjectionException
        Transforms the specified (λ,φ) coordinates (units in radians) and stores the result in ptDst (linear distance on a unit sphere).
        Specified by:
        transformNormalized in class MapProjection
        Parameters:
        x - The longitude of the coordinate, in radians.
        y - The latitude of the coordinate, in radians.
        ptDst - the specified coordinate point that stores the result of transforming ptSrc, or null. Ordinates will be in a dimensionless unit, as a linear distance on a unit sphere or ellipse.
        Returns:
        the coordinate point after transforming (lambda, phi) and storing the result in ptDst.
        Throws:
        ProjectionException - if the point can't be transformed.
      • inverseTransformNormalized

        protected Point2D inverseTransformNormalized​(double x,
                                                     double y,
                                                     Point2D ptDst)
                                              throws ProjectionException
        Transforms the specified (x,y) coordinates and stores the result in ptDst.
        Specified by:
        inverseTransformNormalized in class MapProjection
        Parameters:
        x - The easting of the coordinate, linear distance on a unit sphere or ellipse.
        y - The northing of the coordinate, linear distance on a unit sphere or ellipse.
        ptDst - the specified coordinate point that stores the result of transforming ptSrc, or null. Ordinates will be in radians.
        Returns:
        the coordinate point after transforming x, y and storing the result in ptDst.
        Throws:
        ProjectionException - if the point can't be transformed.
      • hashCode

        public int hashCode()
        Returns a hash value for this projection.
        Overrides:
        hashCode in class MapProjection
      • equals

        public boolean equals​(Object object)
        Compares the specified object with this map projection for equality.
        Overrides:
        equals in class MapProjection
        Parameters:
        object - The object to compare with this transform.
        Returns:
        true if the given object is a transform of the same class and if, given identical source position, the transformed position would be the equals.