Package ucar.visad
Class UTMCoordinateSystem
java.lang.Object
visad.CoordinateSystem
visad.georef.NavigatedCoordinateSystem
visad.georef.MapProjection
ucar.visad.UTMCoordinateSystem
- All Implemented Interfaces:
Serializable
,XmlPersistable
Transforms between UTM coordinates and lat/lon in degrees.
Limitation: all elevations are treated as 0.0.
The VisAD CoordinateSystem "Reference" is lat/lon
(RealTupleType.LatitudeLongitudeTuple).
Uses the SRI geotransform Java package for converters, ellipsoids, etc.
Each UTM position requires a complete specification including an x,y position
in meters, a zone number, a hemisphere boolean flag (true in northern),
and a reference ellipsoid.
- Version:
- $Revision: 1.18 $ $Date: 2005/05/13 18:34:06 $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final geotransform.ellipsoids.Ellipsoid
AA = Airy 1830 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
AM = Modified Airy Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
AN = Australian National Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
BN = Bessel 1841 (Namibia) Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
BR = Bessel 1841 (Ethiopia Indonesia Japan Korea)static final geotransform.ellipsoids.Ellipsoid
CC = Clarke 1866 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
CD = Clarke 1880 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
EA = Everest (India 1830) Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
EB = Everest (Sabah invalid input: '&' Sarawak) Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
EC = Everest (India 1956) Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
ED = Everest (West Malaysia 1969) Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
EE = Everest (West Malaysia invalid input: '&' Singapore 1948)static final geotransform.ellipsoids.Ellipsoid
FA = Modified Fischer 1960 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
HE = Helmert 1906 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
HO = Hough 1960 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
IN = International 1924 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
KA = Krassovsky 1940 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
RF = Geodetic Reference System 1980 (GRS 80)static final geotransform.ellipsoids.Ellipsoid
SA = South American 1969 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
WD = WGS 72 Ellipsoidstatic final geotransform.ellipsoids.Ellipsoid
WE = WGS 84 Ellipsoid -
Constructor Summary
ConstructorsConstructorDescriptionUTMCoordinateSystem
(int zone, boolean hemiflag) Constructs an instance using the WSG 84 ellipsoid, and given zone and hemisphere.UTMCoordinateSystem
(geotransform.ellipsoids.Ellipsoid ellipsoid, int zone, boolean hemiflag) Constructs an instance of a UTM coordinate transform with the supplied Ellipsoid, zone and hemisphere.UTMCoordinateSystem
(geotransform.ellipsoids.Ellipsoid ellipsoid, int zone, boolean hemiflag, Rectangle2D bounds) Constructs an instance of a UTM coordinate transform with the supplied Ellipsoid, zone and hemisphere. -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]
ConvertUtmToLatLon
(double[][] utmcoords, int[] zone, boolean[] hemisphere_north) Convert an array of UTM positions to lat/lon.double[][]
ConvertUtmToLatLon
(double[][] utmcoords, int zone, boolean hemisphere_north) Convert an array of UTM positions to lat/lon.createElement
(XmlEncoder encoder) needed for XmlPersistableboolean
Check for equality of input object to this UTMCoordinateSystem.double[][]
fromReference
(double[][] latlon) Convert from lat/lon (GDC) coordinates to UTM coords.float[][]
fromReference
(float[][] latlon) Convert from lat/lon (GDC) coordinates to UTM coords.Get a bounding box in this coordinate system.boolean
get boolean flag: if UTM positions in the northern hemisphere, true.boolean[]
get array of booleans: if a UTM position is in the northern hemisphere, true.int
getZone()
get single UTM zone number (1...60) for the UTM positions.int[]
get UTM zone numbers (1...60) for the UTM positions.boolean
initFromXml
(XmlEncoder encoder, Element node) Do nothing, return true to tell the encoder that it is ok to process any methods or properties.double[][]
toReference
(double[][] utmcoords) Convert an array of UTM positions to lat/lon.float[][]
toReference
(float[][] utmcoords) Convert an array of UTM positions to lat/lon.toString()
Print elllipsoid mean radius and inverse flatteningMethods inherited from class visad.georef.MapProjection
getCenterLatLon, getFlipX, getFlipY, getLatLon, getXIndex, getYIndex, isLatLonOrder, isXYOrder
Methods inherited from class visad.georef.NavigatedCoordinateSystem
getLatitudeIndex, getLongitudeIndex
Methods inherited from class visad.CoordinateSystem
canConvert, fromReference, fromReference, getCoordinateSystemUnits, getDimension, getReference, getReferenceUnits, toReference, toReference, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinatesFreeUnits, transformCoordinatesFreeUnits
-
Field Details
-
AA
public static final geotransform.ellipsoids.Ellipsoid AAAA = Airy 1830 Ellipsoid -
AM
public static final geotransform.ellipsoids.Ellipsoid AMAM = Modified Airy Ellipsoid -
AN
public static final geotransform.ellipsoids.Ellipsoid ANAN = Australian National Ellipsoid -
BN
public static final geotransform.ellipsoids.Ellipsoid BNBN = Bessel 1841 (Namibia) Ellipsoid -
BR
public static final geotransform.ellipsoids.Ellipsoid BRBR = Bessel 1841 (Ethiopia Indonesia Japan Korea) -
CC
public static final geotransform.ellipsoids.Ellipsoid CCCC = Clarke 1866 Ellipsoid -
CD
public static final geotransform.ellipsoids.Ellipsoid CDCD = Clarke 1880 Ellipsoid -
EA
public static final geotransform.ellipsoids.Ellipsoid EAEA = Everest (India 1830) Ellipsoid -
EB
public static final geotransform.ellipsoids.Ellipsoid EBEB = Everest (Sabah invalid input: '&' Sarawak) Ellipsoid -
EC
public static final geotransform.ellipsoids.Ellipsoid ECEC = Everest (India 1956) Ellipsoid -
ED
public static final geotransform.ellipsoids.Ellipsoid EDED = Everest (West Malaysia 1969) Ellipsoid -
EE
public static final geotransform.ellipsoids.Ellipsoid EEEE = Everest (West Malaysia invalid input: '&' Singapore 1948) -
FA
public static final geotransform.ellipsoids.Ellipsoid FAFA = Modified Fischer 1960 Ellipsoid -
HE
public static final geotransform.ellipsoids.Ellipsoid HEHE = Helmert 1906 Ellipsoid -
HO
public static final geotransform.ellipsoids.Ellipsoid HOHO = Hough 1960 Ellipsoid -
IN
public static final geotransform.ellipsoids.Ellipsoid ININ = International 1924 Ellipsoid -
KA
public static final geotransform.ellipsoids.Ellipsoid KAKA = Krassovsky 1940 Ellipsoid -
RF
public static final geotransform.ellipsoids.Ellipsoid RFRF = Geodetic Reference System 1980 (GRS 80) -
SA
public static final geotransform.ellipsoids.Ellipsoid SASA = South American 1969 Ellipsoid -
WD
public static final geotransform.ellipsoids.Ellipsoid WDWD = WGS 72 Ellipsoid -
WE
public static final geotransform.ellipsoids.Ellipsoid WEWE = WGS 84 Ellipsoid
-
-
Constructor Details
-
UTMCoordinateSystem
public UTMCoordinateSystem(geotransform.ellipsoids.Ellipsoid ellipsoid, int zone, boolean hemiflag) throws VisADException Constructs an instance of a UTM coordinate transform with the supplied Ellipsoid, zone and hemisphere. The ellipsoid should be the one used as a basis for the UTM coordinates. The zone is the UTM zone which has positions to be converted; hemiflag is a boolean, true if points are northern hemisphere. You can convert points from more than one zone and hemisphere by using the method ConvertUtmToLatLon. The reference coordinate system is RealTupleType.LatitudeLongitudeTuple; the incoming units are assumed to be UTM coords based on the input ellipsoid. Most USGS topographic maps use the 1927 North American Datum (NAD 27); new maps are being slowly revised to NAD 83. To construct Ellipsoids for the first argument, import geotransform.jar, and do new CC_Ellipsoid() for NAD 27 (Clark 1866 ellipsoid), or new RF_Ellipsoid() for NAD 83 (GRS 80 ellipsoid), or new WE_Ellipsoid() for WSG 84. See http://www.ai.sri.com/geotransform/api.html for more details about 239 supported datums.- Parameters:
ellipsoid
- the basis for some UTM coordinate system; many choices possiblezone
- the UTM zone which has positions to be convertedhemiflag
- a boolean, true if points are in the northern hemisphere- Throws:
VisADException
- on badness. Throws a NullPointerException if the ellipsoid isnull
.
-
UTMCoordinateSystem
public UTMCoordinateSystem(geotransform.ellipsoids.Ellipsoid ellipsoid, int zone, boolean hemiflag, Rectangle2D bounds) throws VisADException Constructs an instance of a UTM coordinate transform with the supplied Ellipsoid, zone and hemisphere. The ellipsoid should be the one used as a basis for the UTM coordinates. The zone is the UTM zone which has positions to be converted; hemiflag is a boolean, true if points are northern hemisphere. You can convert points from more than one zone and hemisphere by using the method ConvertUtmToLatLon. The reference coordinate system is RealTupleType.LatitudeLongitudeTuple; the incoming units are assumed to be UTM coords based on the input ellipsoid. Most USGS topographic maps use the 1927 North American Datum (NAD 27); new maps are being slowly revised to NAD 83. To construct Ellipsoids for the first argument, import geotransform.jar, and do new CC_Ellipsoid() for NAD 27 (Clark 1866 ellipsoid), or new RF_Ellipsoid() for NAD 83 (GRS 80 ellipsoid), or new WE_Ellipsoid() for WSG 84. See http://www.ai.sri.com/geotransform/api.html for more details about 239 supported datums.- Parameters:
ellipsoid
- the basis for some UTM coordinate system; many choices possiblezone
- the UTM zone which has positions to be convertedhemiflag
- a boolean, true if points are in the northern hemispherebounds
- Linear2DSet describing the bounds of this MapProjection- Throws:
VisADException
-
UTMCoordinateSystem
Constructs an instance using the WSG 84 ellipsoid, and given zone and hemisphere. This ellipsoid should be the one used as a basis for the UTM coordinates. If you don't know the ellipsoid for your UTM values you will get approximately correct conversions using this cstr. "A mismatch between datums on your map and GPS receiver can cause errors of several hundred meters."- Parameters:
zone
- the UTM zone which has positions to be convertedhemiflag
- a boolean, true if points are in the northern hemisphere- Throws:
VisADException
-
-
Method Details
-
toString
Print elllipsoid mean radius and inverse flattening- Overrides:
toString
in classMapProjection
- Returns:
- string version of this
-
equals
Check for equality of input object to this UTMCoordinateSystem.- Specified by:
equals
in classCoordinateSystem
- Parameters:
obj
- other object in question- Returns:
- true if the object in question is a UTMCoordinateSystem and it's ellipsoid, zone, invalid input: '&' hemisphere are equal to this object's values.
-
ConvertUtmToLatLon
public double[][] ConvertUtmToLatLon(double[][] utmcoords, int[] zone, boolean[] hemisphere_north) throws VisADException Convert an array of UTM positions to lat/lon. All elevations zero. The UTM positions may be in more than one zone or one hemisphere. Each UTM position has an x,y pair, a zone number, and a hemisphere boolean flag. Lengths of all three arrays should be the same, the number of positions to convert., or both "zone" and "hemisphere_north" may both have one value for the case where all UTM positions are in the same zone.- Parameters:
utmcoords
- array with UTM x,y values; x=utmcoords[0][i], y=utmcoords[1][i]zone
- array of the UTM zones for each of these positionshemisphere_north
- array of the UTM flags for each of these positions true if the UTM position is in the northern hemisphere- Returns:
- a double[][] array of lat/lon; lat=result[0][i], lon=result[1][i]
- Throws:
VisADException
-
ConvertUtmToLatLon
public double[][] ConvertUtmToLatLon(double[][] utmcoords, int zone, boolean hemisphere_north) throws VisADException Convert an array of UTM positions to lat/lon. The UTM positions are all assumed to be in the given zone and hemisphere args. Each UTM position has an x,y pair, a zone number, and a hemisphere boolean flag. Treats all positions as at zero elevation.- Parameters:
utmcoords
- array with UTM x,y values; x=utmcoords[0][i], y=utmcoords[1][i]zone
- the single UTM zone for all of these positionshemisphere_north
- the hemisphere flag for all of these positions (true=N)- Returns:
- a double [][] array of lat/lon; lat=result[0][i], lon=result[1][i]
- Throws:
VisADException
-
toReference
Convert an array of UTM positions to lat/lon. The UTM positions are all assumed have the zone and hemisphere used in the cstr. Each UTM position has an x,y pair, a zone number, and a hemisphere boolean flag. Treats all positions as at zero elevation.- Specified by:
toReference
in classCoordinateSystem
- Parameters:
utmcoords
- array with UTM x,y values; x=utmcoords[0][i], y=utmcoords[1][i]- Returns:
- a double [][] array of lat/lon; lat=result[0][i], lon=result[1][i]
- Throws:
VisADException
-
toReference
Convert an array of UTM positions to lat/lon. The UTM positions are all assumed have the zone and hemisphere used in the cstr. Each UTM position has an x,y pair, a zone number, and a hemisphere boolean flag. Treats all positions as at zero elevation.- Overrides:
toReference
in classCoordinateSystem
- Parameters:
utmcoords
- array with UTM x,y values; x=utmcoords[0][i], y=utmcoords[1][i]- Returns:
- a double [][] array of lat/lon; lat=result[0][i], lon=result[1][i]
- Throws:
VisADException
-
fromReference
Convert from lat/lon (GDC) coordinates to UTM coords. Note this finds UTM x/y and corresponding UTM zones (1...60) - use method getZoneNumbers(), and hemisphere flags == true if north - use method getHemisphereFlags(). All positions' elevations are set to zero.- Specified by:
fromReference
in classCoordinateSystem
- Parameters:
latlon
- lat/lon values (lat = latlon[0][i], lon=latlon[1][i])- Returns:
- UTM coordinates (x = result[0][i], y=result[1][i])
- Throws:
VisADException
- unable to make transformation
-
fromReference
Convert from lat/lon (GDC) coordinates to UTM coords. Note this finds UTM x/y and corresponding UTM zones (1...60) - use method getZoneNumbers(), and hemisphere flags == true if north - use method getHemisphereFlags(). All positions' elevations are set to zero.- Overrides:
fromReference
in classCoordinateSystem
- Parameters:
latlon
- lat/lon values (lat = latlon[0][i], lon=latlon[1][i])- Returns:
- UTM coordinates (x = result[0][i], y=result[1][i])
- Throws:
VisADException
- unable to make transformation
-
getZoneNumbers
public int[] getZoneNumbers()get UTM zone numbers (1...60) for the UTM positions.- Returns:
- array of zone numbers for values
-
getHemisphereFlags
public boolean[] getHemisphereFlags()get array of booleans: if a UTM position is in the northern hemisphere, true.- Returns:
- array of hemisphere flags for values
-
getZone
public int getZone()get single UTM zone number (1...60) for the UTM positions. Use this only to check constructor argument.- Returns:
- get the UTM zone for the positions
-
getHemisphereFlag
public boolean getHemisphereFlag()get boolean flag: if UTM positions in the northern hemisphere, true. Use this only to check constructor argument.- Returns:
- UTM hemisphere flag for this CS
-
getDefaultMapArea
Get a bounding box in this coordinate system. Return an x-y rectangle that covers most of a UTM zone, in meters.- Specified by:
getDefaultMapArea
in classMapProjection
- Returns:
- a default MapArea of a UTM zone in UTM x-y meters.
-
createElement
needed for XmlPersistable- Specified by:
createElement
in interfaceXmlPersistable
- Parameters:
encoder
- encoder for encoding- Returns:
- this as an encoded Element
-
initFromXml
Do nothing, return true to tell the encoder that it is ok to process any methods or properties. This is needed for XmlPersistable- Specified by:
initFromXml
in interfaceXmlPersistable
- Parameters:
encoder
- encoder for encodingnode
- node to initialize from- Returns:
- true
-