Class Mercator

  • All Implemented Interfaces:
    IScaleFactorProvider, Proj

    public class Mercator
    extends AbstractProj
    implements IScaleFactorProvider
    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 standard parallel cases. For 1 SP (EPSG code 9804), the line of contact is the equator. For 2 SP (EPSG code 9805) lines of contact are symmetrical about the equator.

    This class has been derived from the implementation of the Geotools project; git 8cbf52d, org.geotools.referencing.operation.projection.Mercator at the time of migration.

    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.
    See Also:
    Mercator projection on MathWorld, "mercator_1sp" on RemoteSensing.org, "mercator_2sp" on RemoteSensing.org
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static double EPSILON
      Maximum difference allowed when comparing real numbers.
      protected double scaleFactor  
    • Constructor Summary

      Constructors 
      Constructor Description
      Mercator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Bounds getAlgorithmBounds()
      Return the bounds where this projection is applicable.
      java.lang.String getName()
      Replies a human readable name of this projection.
      java.lang.String getProj4Id()
      Replies the Proj.4 identifier.
      double getScaleFactor()
      Get the scale factor.
      void initialize​(ProjParameters params)
      Initialize the projection using the provided parameters.
      double[] invproject​(double x, double y)
      Convert east/north to lat/lon.
      boolean lonIsLinearToEast()
      Checks whether the result of projecting a lon coordinate only has a linear relation to the east coordinate and is not related to lat/north at all.
      double[] project​(double y, double x)
      Convert lat/lon to east/north.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: Proj
        Replies a human readable name of this projection.
        Specified by:
        getName in interface Proj
        Returns:
        The projection name. must not be null.
      • getProj4Id

        public java.lang.String getProj4Id()
        Description copied from interface: Proj
        Replies the Proj.4 identifier.
        Specified by:
        getProj4Id in interface Proj
        Returns:
        The Proj.4 identifier (as reported by cs2cs -lp). If no id exists, return null.
      • project

        public double[] project​(double y,
                                double x)
        Description copied from interface: Proj
        Convert lat/lon to east/north.
        Specified by:
        project in interface Proj
        Parameters:
        y - the latitude in radians
        x - the longitude in radians
        Returns:
        array of length 2, containing east and north value in meters, divided by the semi major axis of the ellipsoid.
      • invproject

        public double[] invproject​(double x,
                                   double y)
        Description copied from interface: Proj
        Convert east/north to lat/lon.
        Specified by:
        invproject in interface Proj
        Parameters:
        x - east value in meters, divided by the semi major axis of the ellipsoid
        y - north value in meters, divided by the semi major axis of the ellipsoid
        Returns:
        array of length 2, containing lat and lon in radians.
      • getAlgorithmBounds

        public Bounds getAlgorithmBounds()
        Description copied from interface: Proj
        Return the bounds where this projection is applicable. This is a fallback for when the projection bounds are not specified explicitly. In this area, the round trip lat/lon → east/north → lat/lon should return the starting value with small error. In addition, regions with extreme distortions should be excluded, if possible. It need not be the absolute maximum, but rather an area that is safe to display in JOSM and contain everything that one would expect to use.
        Specified by:
        getAlgorithmBounds in interface Proj
        Returns:
        the bounds where this projection is applicable, null if unknown
      • lonIsLinearToEast

        public boolean lonIsLinearToEast()
        Description copied from interface: Proj
        Checks whether the result of projecting a lon coordinate only has a linear relation to the east coordinate and is not related to lat/north at all.
        Specified by:
        lonIsLinearToEast in interface Proj
        Returns:
        true if lon has a linear relationship to east only.