Class Mercator
- 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.
-
-
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 org.openstreetmap.josm.data.projection.proj.AbstractProj
aasin, cphi2, invMlfn, isGeographic, mlfn, msfn, tsfn
-
-
-
-
Field Detail
-
EPSILON
private static final double EPSILON
Maximum difference allowed when comparing real numbers.- See Also:
- Constant Field Values
-
scaleFactor
protected double scaleFactor
-
-
Constructor Detail
-
Mercator
public Mercator()
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:Proj
Replies a human readable name of this projection.
-
getProj4Id
public java.lang.String getProj4Id()
Description copied from interface:Proj
Replies the Proj.4 identifier.- Specified by:
getProj4Id
in interfaceProj
- Returns:
- The Proj.4 identifier (as reported by cs2cs -lp).
If no id exists, return
null
.
-
initialize
public void initialize(ProjParameters params) throws ProjectionConfigurationException
Description copied from interface:Proj
Initialize the projection using the provided parameters.- Specified by:
initialize
in interfaceProj
- Overrides:
initialize
in classAbstractProj
- 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.
-
invproject
public double[] invproject(double x, double y)
Description copied from interface:Proj
Convert east/north to lat/lon.- Specified by:
invproject
in interfaceProj
- Parameters:
x
- east value in meters, divided by the semi major axis of the ellipsoidy
- 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 interfaceProj
- 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 interfaceIScaleFactorProvider
- 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 interfaceProj
- Returns:
true
if lon has a linear relationship to east only.
-
-