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 BoundsgetAlgorithmBounds()Return the bounds where this projection is applicable.java.lang.StringgetName()Replies a human readable name of this projection.java.lang.StringgetProj4Id()Replies the Proj.4 identifier.doublegetScaleFactor()Get the scale factor.voidinitialize(ProjParameters params)Initialize the projection using the provided parameters.double[]invproject(double x, double y)Convert east/north to lat/lon.booleanlonIsLinearToEast()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:ProjReplies a human readable name of this projection.
-
getProj4Id
public java.lang.String getProj4Id()
Description copied from interface:ProjReplies the Proj.4 identifier.- Specified by:
getProj4Idin 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:ProjInitialize the projection using the provided parameters.- Specified by:
initializein interfaceProj- Overrides:
initializein 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:ProjConvert lat/lon to east/north.
-
invproject
public double[] invproject(double x, double y)
Description copied from interface:ProjConvert east/north to lat/lon.- Specified by:
invprojectin 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:ProjReturn 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:
getAlgorithmBoundsin interfaceProj- Returns:
- the bounds where this projection is applicable, null if unknown
-
getScaleFactor
public double getScaleFactor()
Description copied from interface:IScaleFactorProviderGet the scale factor. Will be multiplied by the scale factor parameter, if supplied by the user explicitly.- Specified by:
getScaleFactorin interfaceIScaleFactorProvider- Returns:
- the scale factor
-
lonIsLinearToEast
public boolean lonIsLinearToEast()
Description copied from interface:ProjChecks 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:
lonIsLinearToEastin interfaceProj- Returns:
trueif lon has a linear relationship to east only.
-
-