Class ObliqueMercator
- java.lang.Object
-
- org.openstreetmap.josm.data.projection.proj.AbstractProj
-
- org.openstreetmap.josm.data.projection.proj.ObliqueMercator
-
- All Implemented Interfaces:
ICentralMeridianProvider
,Proj
public class ObliqueMercator extends AbstractProj implements ICentralMeridianProvider
Oblique Mercator Projection. A conformal, oblique, cylindrical projection with the cylinder touching the ellipsoid (or sphere) along a great circle path (the central line). The Mercator and Transverse Mercator projections can be thought of as special cases of the oblique mercator, where the central line is along the equator or a meridian, respectively. The Oblique Mercator projection has been used in Switzerland, Hungary, Madagascar, Malaysia, Borneo and the panhandle of Alaska.The Oblique Mercator projection uses a (U,V) coordinate system, with the U axis along the central line. During the forward projection, coordinates from the ellipsoid are projected conformally to a sphere of constant total curvature, called the "aposphere", before being projected onto the plane. The projection coordinates are further convented to a (X,Y) coordinate system by rotating the calculated (u,v) coordinates to give output (x,y) coordinates. The rotation value is usually the same as the projection azimuth (the angle, east of north, of the central line), but some cases allow a separate rotation parameter.
There are two forms of the oblique mercator, differing in the origin of their grid coordinates. The Hotine Oblique Mercator (EPSG code 9812) has grid coordinates start at the intersection of the central line and the equator of the aposphere. The Oblique Mercator (EPSG code 9815) is the same, except the grid coordinates begin at the central point (where the latitude of center and central line intersect). ESRI separates these two case by appending
"Natural_Origin"
(for the"Hotine_Oblique_Mercator"
) and"Center"
(for the"Oblique_Mercator"
) to the projection names.Two different methods are used to specify the central line for the oblique mercator: 1) a central point and an azimuth, east of north, describing the central line and 2) two points on the central line. The EPSG does not use the two point method, while ESRI separates the two cases by putting
"Azimuth"
and"Two_Point"
in their projection names. Both cases use the point where the"latitude_of_center"
parameter crosses the central line as the projection's central point. The central meridian is not a projection parameter, and is instead calculated as the intersection between the central line and the equator of the aposphere.For the azimuth method, the central latitude cannot be ±90.0 degrees and the central line cannot be at a maximum or minimum latitude at the central point. In the two point method, the latitude of the first and second points cannot be equal. Also, the latitude of the first point and central point cannot be ±90.0 degrees. Furthermore, the latitude of the first point cannot be 0.0 and the latitude of the second point cannot be -90.0 degrees. A change of 10-7 radians can allow calculation at these special cases. Snyder's restriction of the central latitude being 0.0 has been removed, since the equations appear to work correctly in this case.
Azimuth values of 0.0 and ±90.0 degrees are allowed (and used in Hungary and Switzerland), though these cases would usually use a Mercator or Transverse Mercator projection instead. Azimuth values > 90 degrees cause errors in the equations.
The oblique mercator is also called the "Rectified Skew Orthomorphic" (RSO). It appears is that the only difference from the oblique mercator is that the RSO allows the rotation from the (U,V) to (X,Y) coordinate system to be different from the azimuth. This separate parameter is called
"rectified_grid_angle"
(or"XY_Plane_Rotation"
by ESRI) and is also included in the EPSG's parameters for the Oblique Mercator and Hotine Oblique Mercator. The rotation parameter is optional in all the non-two point projections and will be set to the azimuth if not specified.Projection cases and aliases implemented by the
ObliqueMercator
are:Oblique_Mercator
(EPSG code 9815)
grid coordinates begin at the central point, has"rectified_grid_angle"
parameter.Hotine_Oblique_Mercator_Azimuth_Center
(ESRI)
grid coordinates begin at the central point.Rectified_Skew_Orthomorphic_Center
(ESRI)
grid coordinates begin at the central point, has"rectified_grid_angle"
parameter.Hotine_Oblique_Mercator
(EPSG code 9812)
grid coordinates begin at the intersection of the central line and aposphere equator, has"rectified_grid_angle"
parameter.Hotine_Oblique_Mercator_Azimuth_Natural_Origin
(ESRI)
grid coordinates begin at the interseciton of the central line and aposphere equator.Rectified_Skew_Orthomorphic_Natural_Origin
(ESRI)
grid coordinates begin at the interseciton of the central line and aposphere equator, has"rectified_grid_angle"
parameter.Hotine_Oblique_Mercator_Two_Point_Center
(ESRI)
grid coordinates begin at the central point.Hotine_Oblique_Mercator_Two_Point_Natural_Origin
(ESRI)
grid coordinates begin at the interseciton of the central line and aposphere equator.
This class has been derived from the implementation of the Geotools project; git 8cbf52d, org.geotools.referencing.operation.projection.ObliqueMercator at the time of migration.
Note that automatic calculation of bounds is very limited for this projection, since the central line can have any orientation.
References:
libproj4
is available at libproj4 Miscellanea
Relevent files are:PJ_omerc.c
,pj_tsfn.c
,pj_fwd.c
,pj_inv.c
andlib_proj.h
- 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 part 2, Version 24.
- Gerald Evenden, 2004, Documentation of revised Oblique Mercator
-
-
Field Summary
Fields Modifier and Type Field Description private double
ab
Convenience value equal toa
×b
.private double
arb
Convenience value equal toa
/b
.protected double
azimuth
The azimuth of the central line passing through the centre of the projection, in radians.private double
b
Constants used in the transformation.private double
bra
Convenience value equal tob
/a
.protected double
centralMeridian
Central longitude in radians.private double
cosgamma0
Sine and Cosine values for gamma0 (the angle between the meridian and central line at the intersection between the central line and the Earth equator on aposphere).private double
cosrot
Sine and Cosine values for the rotation between (U,V) and (X,Y) coordinate systemsprivate static double
EPSILON
Maximum difference allowed when comparing real numbers.private static double
EPSILON_LATITUDE
Maximum difference allowed when comparing latitudes.private double
g
Constants used in the transformation.protected double
rectifiedGridAngle
The rectified bearing of the central line, in radians.private LatLon
referencePoint
A reference point, which is known to be on the central line.private double
singamma0
Sine and Cosine values for gamma0 (the angle between the meridian and central line at the intersection between the central line and the Earth equator on aposphere).private double
sinrot
Sine and Cosine values for the rotation between (U,V) and (X,Y) coordinate systemsprivate double
uc
u value (in (U,V) coordinate system) of the central point.private double
vPoleN
v values when the input latitude is a pole.private double
vPoleS
v values when the input latitude is a pole.
-
Constructor Summary
Constructors Constructor Description ObliqueMercator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Bounds
getAlgorithmBounds()
Return the bounds where this projection is applicable.double
getCentralMeridian()
Get the central meridian value as computed during initialization.String
getName()
Replies a human readable name of this projection.String
getProj4Id()
Replies the Proj.4 identifier.void
initialize(ProjParameters params)
Initialize the projection using the provided parameters.double[]
invproject(double x, double y)
Convert east/north to lat/lon.private static double
normalizeLonRad(double a)
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.projection.proj.Proj
lonIsLinearToEast
-
-
-
-
Field Detail
-
EPSILON
private static final double EPSILON
Maximum difference allowed when comparing real numbers.- See Also:
- Constant Field Values
-
EPSILON_LATITUDE
private static final double EPSILON_LATITUDE
Maximum difference allowed when comparing latitudes.- See Also:
- Constant Field Values
-
azimuth
protected double azimuth
The azimuth of the central line passing through the centre of the projection, in radians.
-
rectifiedGridAngle
protected double rectifiedGridAngle
The rectified bearing of the central line, in radians. This is equals to the azimuth if the parameter value is not set.
-
b
private double b
Constants used in the transformation.
-
g
private double g
Constants used in the transformation.
-
vPoleN
private double vPoleN
v values when the input latitude is a pole.
-
vPoleS
private double vPoleS
v values when the input latitude is a pole.
-
singamma0
private double singamma0
Sine and Cosine values for gamma0 (the angle between the meridian and central line at the intersection between the central line and the Earth equator on aposphere).
-
cosgamma0
private double cosgamma0
Sine and Cosine values for gamma0 (the angle between the meridian and central line at the intersection between the central line and the Earth equator on aposphere).
-
sinrot
private double sinrot
Sine and Cosine values for the rotation between (U,V) and (X,Y) coordinate systems
-
cosrot
private double cosrot
Sine and Cosine values for the rotation between (U,V) and (X,Y) coordinate systems
-
uc
private double uc
u value (in (U,V) coordinate system) of the central point. Used in the oblique mercator case. The v value of the central point is 0.0.
-
centralMeridian
protected double centralMeridian
Central longitude in radians. Default value is 0, the Greenwich meridian. This is called 'lambda0' in Snyder.
-
referencePoint
private LatLon referencePoint
A reference point, which is known to be on the central line.
-
-
Constructor Detail
-
ObliqueMercator
public ObliqueMercator()
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:Proj
Replies a human readable name of this projection.
-
getProj4Id
public 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
-
normalizeLonRad
private static double normalizeLonRad(double a)
-
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
-
getCentralMeridian
public double getCentralMeridian()
Description copied from interface:ICentralMeridianProvider
Get the central meridian value as computed during initialization.- Specified by:
getCentralMeridian
in interfaceICentralMeridianProvider
- Returns:
- the central meridian in degrees
-
-