Package ucar.visad

Class UTMCoordinateSystem

All Implemented Interfaces:
Serializable, XmlPersistable

public class UTMCoordinateSystem extends MapProjection implements 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

    Fields
    Modifier and Type
    Field
    Description
    static final geotransform.ellipsoids.Ellipsoid
    AA = Airy 1830 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    AM = Modified Airy Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    AN = Australian National Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    BN = Bessel 1841 (Namibia) Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    BR = Bessel 1841 (Ethiopia Indonesia Japan Korea)
    static final geotransform.ellipsoids.Ellipsoid
    CC = Clarke 1866 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    CD = Clarke 1880 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    EA = Everest (India 1830) Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    EB = Everest (Sabah invalid input: '&' Sarawak) Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    EC = Everest (India 1956) Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    ED = Everest (West Malaysia 1969) Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    EE = Everest (West Malaysia invalid input: '&' Singapore 1948)
    static final geotransform.ellipsoids.Ellipsoid
    FA = Modified Fischer 1960 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    HE = Helmert 1906 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    HO = Hough 1960 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    IN = International 1924 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    KA = Krassovsky 1940 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    RF = Geodetic Reference System 1980 (GRS 80)
    static final geotransform.ellipsoids.Ellipsoid
    SA = South American 1969 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    WD = WGS 72 Ellipsoid
    static final geotransform.ellipsoids.Ellipsoid
    WE = WGS 84 Ellipsoid
  • Constructor Summary

    Constructors
    Constructor
    Description
    UTMCoordinateSystem(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 Type
    Method
    Description
    double[][]
    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.
    needed for XmlPersistable
    boolean
    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
    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.
    Print elllipsoid mean radius and inverse flattening

    Methods inherited from class visad.georef.NavigatedCoordinateSystem

    getLatitudeIndex, getLongitudeIndex

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • AA

      public static final geotransform.ellipsoids.Ellipsoid AA
      AA = Airy 1830 Ellipsoid
    • AM

      public static final geotransform.ellipsoids.Ellipsoid AM
      AM = Modified Airy Ellipsoid
    • AN

      public static final geotransform.ellipsoids.Ellipsoid AN
      AN = Australian National Ellipsoid
    • BN

      public static final geotransform.ellipsoids.Ellipsoid BN
      BN = Bessel 1841 (Namibia) Ellipsoid
    • BR

      public static final geotransform.ellipsoids.Ellipsoid BR
      BR = Bessel 1841 (Ethiopia Indonesia Japan Korea)
    • CC

      public static final geotransform.ellipsoids.Ellipsoid CC
      CC = Clarke 1866 Ellipsoid
    • CD

      public static final geotransform.ellipsoids.Ellipsoid CD
      CD = Clarke 1880 Ellipsoid
    • EA

      public static final geotransform.ellipsoids.Ellipsoid EA
      EA = Everest (India 1830) Ellipsoid
    • EB

      public static final geotransform.ellipsoids.Ellipsoid EB
      EB = Everest (Sabah invalid input: '&' Sarawak) Ellipsoid
    • EC

      public static final geotransform.ellipsoids.Ellipsoid EC
      EC = Everest (India 1956) Ellipsoid
    • ED

      public static final geotransform.ellipsoids.Ellipsoid ED
      ED = Everest (West Malaysia 1969) Ellipsoid
    • EE

      public static final geotransform.ellipsoids.Ellipsoid EE
      EE = Everest (West Malaysia invalid input: '&' Singapore 1948)
    • FA

      public static final geotransform.ellipsoids.Ellipsoid FA
      FA = Modified Fischer 1960 Ellipsoid
    • HE

      public static final geotransform.ellipsoids.Ellipsoid HE
      HE = Helmert 1906 Ellipsoid
    • HO

      public static final geotransform.ellipsoids.Ellipsoid HO
      HO = Hough 1960 Ellipsoid
    • IN

      public static final geotransform.ellipsoids.Ellipsoid IN
      IN = International 1924 Ellipsoid
    • KA

      public static final geotransform.ellipsoids.Ellipsoid KA
      KA = Krassovsky 1940 Ellipsoid
    • RF

      public static final geotransform.ellipsoids.Ellipsoid RF
      RF = Geodetic Reference System 1980 (GRS 80)
    • SA

      public static final geotransform.ellipsoids.Ellipsoid SA
      SA = South American 1969 Ellipsoid
    • WD

      public static final geotransform.ellipsoids.Ellipsoid WD
      WD = WGS 72 Ellipsoid
    • WE

      public static final geotransform.ellipsoids.Ellipsoid WE
      WE = 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 possible
      zone - the UTM zone which has positions to be converted
      hemiflag - a boolean, true if points are in the northern hemisphere
      Throws:
      VisADException - on badness. Throws a NullPointerException if the ellipsoid is null.
    • 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 possible
      zone - the UTM zone which has positions to be converted
      hemiflag - a boolean, true if points are in the northern hemisphere
      bounds - Linear2DSet describing the bounds of this MapProjection
      Throws:
      VisADException
    • UTMCoordinateSystem

      public UTMCoordinateSystem(int zone, boolean hemiflag) throws VisADException
      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 converted
      hemiflag - a boolean, true if points are in the northern hemisphere
      Throws:
      VisADException
  • Method Details

    • toString

      public String toString()
      Print elllipsoid mean radius and inverse flattening
      Overrides:
      toString in class MapProjection
      Returns:
      string version of this
    • equals

      public boolean equals(Object obj)
      Check for equality of input object to this UTMCoordinateSystem.
      Specified by:
      equals in class CoordinateSystem
      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 positions
      hemisphere_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 positions
      hemisphere_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

      public double[][] toReference(double[][] utmcoords) throws VisADException
      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 class CoordinateSystem
      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

      public float[][] toReference(float[][] utmcoords) throws VisADException
      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 class CoordinateSystem
      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

      public double[][] fromReference(double[][] latlon) throws VisADException
      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 class CoordinateSystem
      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

      public float[][] fromReference(float[][] latlon) throws VisADException
      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 class CoordinateSystem
      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

      public Rectangle2D 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 class MapProjection
      Returns:
      a default MapArea of a UTM zone in UTM x-y meters.
    • createElement

      public Element createElement(XmlEncoder encoder)
      needed for XmlPersistable
      Specified by:
      createElement in interface XmlPersistable
      Parameters:
      encoder - encoder for encoding
      Returns:
      this as an encoded Element
    • initFromXml

      public boolean initFromXml(XmlEncoder encoder, Element node)
      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 interface XmlPersistable
      Parameters:
      encoder - encoder for encoding
      node - node to initialize from
      Returns:
      true