Class Mercator
java.lang.Object
org.openstreetmap.josm.data.projection.proj.AbstractProj
org.openstreetmap.josm.data.projection.proj.Mercator
- All Implemented Interfaces:
IScaleFactorProvider,Proj
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final doubleMaximum difference allowed when comparing real numbers.protected double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the bounds where this projection is applicable.getName()Replies a human readable name of this projection.Replies the Proj.4 identifier.doubleGet 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.booleanChecks 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 Details
-
EPSILON
Maximum difference allowed when comparing real numbers.- See Also:
-
scaleFactor
-
-
Constructor Details
-
Mercator
public Mercator()
-
-
Method Details
-
getName
Description copied from interface:ProjReplies a human readable name of this projection. -
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
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
Description copied from interface:ProjConvert lat/lon to east/north. -
invproject
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
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
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
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.
-