java.lang.Object
org.openstreetmap.josm.data.projection.proj.AbstractProj
org.openstreetmap.josm.data.projection.proj.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:
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public 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 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.
    • initialize

      Description copied from interface: Proj
      Initialize the projection using the provided parameters.
      Specified by:
      initialize in interface Proj
      Overrides:
      initialize in class AbstractProj
      Parameters:
      params - The projection parameters
      Throws:
      ProjectionConfigurationException - in case parameters are not suitable
    • 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

      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
    • getScaleFactor

      public double getScaleFactor()
      Description copied from interface: IScaleFactorProvider
      Get the scale factor. Will be multiplied by the scale factor parameter, if supplied by the user explicitly.
      Specified by:
      getScaleFactor in interface IScaleFactorProvider
      Returns:
      the scale factor
    • 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.