Class TransverseMercator
- java.lang.Object
-
- org.openstreetmap.josm.data.projection.proj.AbstractProj
-
- org.openstreetmap.josm.data.projection.proj.TransverseMercator
-
- All Implemented Interfaces:
Proj
public class TransverseMercator extends AbstractProj
Transverse Mercator Projection (EPSG code 9807). This is a cylindrical projection, in which the cylinder has been rotated 90°. Instead of being tangent to the equator (or to an other standard latitude), it is tangent to a central meridian. Deformation are more important as we are going further from the central meridian. The Transverse Mercator projection is appropriate for region which have a greater extent north-south than east-west.The elliptical equations used here are series approximations, and their accuracy decreases as points move farther from the central meridian of the projection. The forward equations here are accurate to a less than a mm ±10 degrees from the central meridian, a few mm ±15 degrees from the central meridian and a few cm ±20 degrees from the central meridian. The spherical equations are not approximations and should always give the correct values.
There are a number of versions of the transverse mercator projection including the Universal (UTM) and Modified (MTM) Transverses Mercator projections. In these cases the earth is divided into zones. For the UTM the zones are 6 degrees wide, numbered from 1 to 60 proceeding east from 180 degrees longitude, and between lats 84 degrees North and 80 degrees South. The central meridian is taken as the center of the zone and the latitude of origin is the equator. A scale factor of 0.9996 and false easting of 500000m is used for all zones and a false northing of 10000000m is used for zones in the southern hemisphere.
NOTE: formulas used below are not those of Snyder, but rather those from the
proj4
package of the USGS survey, which have been reproduced verbatim. USGS work is acknowledged here.This class has been derived from the implementation of the Geotools project; git 8cbf52d, org.geotools.referencing.operation.projection.TransverseMercator at the time of migration.
The non-standard parameter
gamma
has been added as a method to rotate the projected coordinates by a certain angle (clockwise, seeObliqueMercator
).References:
- Proj-4.4.6 available at www.remotesensing.org/proj
Relevent files are:PJ_tmerc.c
,pj_mlfn.c
,pj_fwd.c
andpj_inv.c
. - 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TransverseMercator.Hemisphere
Earth emispheres
-
Field Summary
Fields Modifier and Type Field Description private double
cosrot
Sine and Cosine values for the coordinate system rotation angleprivate double
eb2
A derived quantity of excentricity, computed bye'² = (a²-b²)/b² = es/(1-es)
where a is the semi-major axis length and b is the semi-minor axis length.private static double
EPSILON
Maximum difference allowed when comparing real numbers.private static double
FC1
Constants used for the forward and inverse transform for the elliptical case of the Transverse Mercator.private static double
FC2
private static double
FC3
private static double
FC4
private static double
FC5
private static double
FC6
private static double
FC7
private static double
FC8
protected double
latitudeOfOrigin
Latitude of origin in radians.private double
ml0
Meridian distance at thelatitudeOfOrigin
.protected double
rectifiedGridAngle
The rectified bearing of the central line, in radians.private double
sinrot
Sine and Cosine values for the coordinate system rotation angle
-
Constructor Summary
Constructors Constructor Description TransverseMercator()
-
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.java.lang.String
getName()
Replies a human readable name of this projection.java.lang.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.static Pair<java.lang.Integer,TransverseMercator.Hemisphere>
locateUtmZone(LatLon ll)
Determines the UTM zone of a given lat/lon.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
-
FC1
private static final double FC1
Constants used for the forward and inverse transform for the elliptical case of the Transverse Mercator.- See Also:
- Constant Field Values
-
FC2
private static final double FC2
- See Also:
- Constant Field Values
-
FC3
private static final double FC3
- See Also:
- Constant Field Values
-
FC4
private static final double FC4
- See Also:
- Constant Field Values
-
FC5
private static final double FC5
- See Also:
- Constant Field Values
-
FC6
private static final double FC6
- See Also:
- Constant Field Values
-
FC7
private static final double FC7
- See Also:
- Constant Field Values
-
FC8
private static final double FC8
- See Also:
- Constant Field Values
-
EPSILON
private static final double EPSILON
Maximum difference allowed when comparing real numbers.- See Also:
- Constant Field Values
-
eb2
private double eb2
A derived quantity of excentricity, computed bye'² = (a²-b²)/b² = es/(1-es)
where a is the semi-major axis length and b is the semi-minor axis length.
-
latitudeOfOrigin
protected double latitudeOfOrigin
Latitude of origin in radians. Default value is 0, the equator. This is called 'phi0' in Snyder.
-
ml0
private double ml0
Meridian distance at thelatitudeOfOrigin
. Used for calculations for the ellipsoid.
-
rectifiedGridAngle
protected double rectifiedGridAngle
The rectified bearing of the central line, in radians.
-
sinrot
private double sinrot
Sine and Cosine values for the coordinate system rotation angle
-
cosrot
private double cosrot
Sine and Cosine values for the coordinate system rotation angle
-
-
Constructor Detail
-
TransverseMercator
public TransverseMercator()
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:Proj
Replies a human readable name of this projection.- Returns:
- The projection name. must not be null.
-
getProj4Id
public java.lang.String getProj4Id()
Description copied from interface:Proj
Replies the Proj.4 identifier.- 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.- Parameters:
y
- the latitude in radiansx
- 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.- 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.- Returns:
- the bounds where this projection is applicable, null if unknown
-
locateUtmZone
public static Pair<java.lang.Integer,TransverseMercator.Hemisphere> locateUtmZone(LatLon ll)
Determines the UTM zone of a given lat/lon.- Parameters:
ll
- lat/lon to locate in the UTM grid.- Returns:
- the UTM zone of
ll
- Since:
- 13167
-
-