public class UTMPoint
extends java.lang.Object
Adapted to Java by Colin Mummery (colin_mummery@yahoo.com) from C++ code by Chuck Gantz (chuck.gantz@globalstar.com)
Modifier and Type | Field and Description |
---|---|
double |
easting
The easting component of the coordinate.
|
double |
northing
The northing component of the coordinate.
|
char |
zone_letter
For UTM, 'N' or 'S', to designate the northern or southern hemisphere.
|
int |
zone_number
The zone number of the coordinate, must be between 1 and 60.
|
Constructor and Description |
---|
UTMPoint()
Point to create if you are going to use the static methods to fill the
values in.
|
UTMPoint(double northing,
double easting,
int zone_number,
char zone_letter)
Constructs a new UTM instance.
|
UTMPoint(LatLonPoint llpoint)
Construct a UTMPoint from a LatLonPoint, assuming a WGS_84 ellipsoid.
|
UTMPoint(LatLonPoint llpoint,
Ellipsoid ellip)
Construct a UTMPoint from a LatLonPoint and a particular ellipsoid.
|
UTMPoint(UTMPoint point)
Constructs a new UTMPoint instance from values in another UTMPoint.
|
Modifier and Type | Method and Description |
---|---|
protected char |
checkZone(char zone)
Method that provides a check for UTM zone letters.
|
boolean |
equals(java.lang.Object obj) |
protected char |
getLetterDesignator(double lat)
Returns 'N' if the latitude is equal to or above the equator, 'S' if it's
below.
|
static int |
getZoneNumber(double lat,
double lon)
Find zone number based on the given latitude and longitude in *degrees*.
|
int |
hashCode() |
static UTMPoint |
LLtoUTM(LatLonPoint llpoint)
Converts a LatLonPoint to a UTM Point, assuming the WGS_84 ellipsoid.
|
static UTMPoint |
LLtoUTM(LatLonPoint llpoint,
Ellipsoid ellip,
UTMPoint utmpoint)
Converts a set of Longitude and Latitude co-ordinates to UTM given an
ellipsoid
|
static UTMPoint |
LLtoUTM(LatLonPoint llpoint,
Ellipsoid ellip,
UTMPoint utmPoint,
int zoneNumber,
boolean isNorthern)
Converts a set of Longitude and Latitude co-ordinates to UTM given an
ellipsoid and the UTM zone to use.
|
static UTMPoint |
LLtoUTM(LatLonPoint llpoint,
UTMPoint utmpoint)
Converts a LatLonPoint to a UTM Point.
|
LatLonPoint |
toLatLonPoint()
Convert this UTMPoint to a LatLonPoint, and assume a WGS_84 ellipsoid.
|
LatLonPoint |
toLatLonPoint(Ellipsoid ellip)
Convert this UTMPoint to a LatLonPoint, and use the given ellipsoid.
|
LatLonPoint |
toLatLonPoint(Ellipsoid ellip,
LatLonPoint llpoint)
Fill in the given LatLonPoint with the converted values of this UTMPoint,
and use the given ellipsoid.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
static LatLonPoint |
UTMtoLL(Ellipsoid ellip,
double UTMNorthing,
double UTMEasting,
int ZoneNumber,
boolean isNorthern,
LatLonPoint llpoint)
Converts UTM coords to lat/long given an ellipsoid.
|
static LatLonPoint |
UTMtoLL(Ellipsoid ellip,
double UTMNorthing,
double UTMEasting,
int zoneNumber,
char zoneLetter,
LatLonPoint llpoint)
Converts UTM coords to lat/long given an ellipsoid.
|
static LatLonPoint |
UTMtoLL(Ellipsoid ellip,
double UTMNorthing,
double UTMEasting,
java.lang.String UTMZone,
LatLonPoint llpoint)
Converts UTM coords to lat/long given an ellipsoid.
|
static LatLonPoint |
UTMtoLL(UTMPoint utm_point,
Ellipsoid ellip,
LatLonPoint llpoint)
Converts UTM coords to lat/long given an ellipsoid given an instance of
UTMPoint.
|
public double northing
public double easting
public int zone_number
public char zone_letter
public UTMPoint()
public UTMPoint(double northing, double easting, int zone_number, char zone_letter)
northing
- The northing component.easting
- The easting component.zone_number
- The zone of the coordinate.zone_letter
- For UTM, 'N' or 'S', to designate the northern or
southern hemisphere.java.lang.Number
- format exception of N or S isn't used.public UTMPoint(UTMPoint point)
public UTMPoint(LatLonPoint llpoint)
public UTMPoint(LatLonPoint llpoint, Ellipsoid ellip)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected char checkZone(char zone)
java.lang.NumberFormatException
- if zone letter is invalid.public LatLonPoint toLatLonPoint()
public LatLonPoint toLatLonPoint(Ellipsoid ellip)
public LatLonPoint toLatLonPoint(Ellipsoid ellip, LatLonPoint llpoint)
public java.lang.String toString()
toString
in class java.lang.Object
public static UTMPoint LLtoUTM(LatLonPoint llpoint)
public static UTMPoint LLtoUTM(LatLonPoint llpoint, UTMPoint utmpoint)
llpoint
- the LatLonPoint to convert.utmpoint
- a UTMPoint to put the results in. If it's null, a
UTMPoint will be allocated.public static UTMPoint LLtoUTM(LatLonPoint llpoint, Ellipsoid ellip, UTMPoint utmpoint)
ellip
- an ellipsoid definition.llpoint
- the coordinate to be convertedutmpoint
- A UTMPoint instance to put the results in. If null, a new
UTMPoint will be allocated.null
if
conversion failed. If you pass in a UTMPoint, it will be returned
as well if successful.public static UTMPoint LLtoUTM(LatLonPoint llpoint, Ellipsoid ellip, UTMPoint utmPoint, int zoneNumber, boolean isNorthern)
ellip
- an ellipsoid definition.llpoint
- the coordinate to be convertedutmPoint
- A UTMPoint instance to put the results in. If null, a new
UTMPoint will be allocated.zoneNumber
- the number of the zoneisNorthern
- true if zone is in northern hemispeherenull
if
conversion failed. If you pass in a UTMPoint, it will be returned
as well if successful.protected char getLetterDesignator(double lat)
lat
- The float value of the latitude.public int hashCode()
hashCode
in class java.lang.Object
public static LatLonPoint UTMtoLL(UTMPoint utm_point, Ellipsoid ellip, LatLonPoint llpoint)
utm_point
- A UTMPoint instance.ellip
- a ellipsoid definition.llpoint
- a LatLonPoint, if you want it to be filled in with the
results. If null, a new LatLonPoint will be allocated.null
if conversion failed. If you pass in a
LatLonPoint, it will be returned as well, if successful.public static LatLonPoint UTMtoLL(Ellipsoid ellip, double UTMNorthing, double UTMEasting, java.lang.String UTMZone, LatLonPoint llpoint)
ellip
- an ellipsoid definition.UTMNorthing
- A float value for the northing to be converted.UTMEasting
- A float value for the easting to be converted.UTMZone
- A String value for the UTM zone eg."60N".llpoint
- a LatLonPoint, if you want it to be filled in with the
results. If null, a new LatLonPoint will be allocated.null
if conversion failed. If you pass in a
LatLonPoint, it will be returned as well, if successful.public static LatLonPoint UTMtoLL(Ellipsoid ellip, double UTMNorthing, double UTMEasting, int ZoneNumber, boolean isNorthern, LatLonPoint llpoint)
ellip
- an ellipsoid definition.UTMNorthing
- A float value for the northing to be converted.UTMEasting
- A float value for the easting to be converted.ZoneNumber
- An int value indicating the float number.isNorthern
- A boolean which is true for the northern hemisphere
otherwise false for the southern.llpoint
- a LatLonPoint, if you want it to be filled in with the
results. If null, a new LatLonPoint will be allocated.null
if conversion failed. If you pass in a
LatLonPoint, it will be returned as well, if successful.public static LatLonPoint UTMtoLL(Ellipsoid ellip, double UTMNorthing, double UTMEasting, int zoneNumber, char zoneLetter, LatLonPoint llpoint)
Equations from USGS Bulletin 1532
East Longitudes are positive, West longitudes are negative.
North latitudes are positive, South latitudes are negative.
ellip
- an ellipsoid definition.UTMNorthing
- A float value for the northing to be converted.UTMEasting
- A float value for the easting to be converted.zoneNumber
- An int value specifiying the UTM zone number.zoneLetter
- A char value specifying the ZoneLetter within the
ZoneNumber.llpoint
- a LatLonPoint, if you want it to be filled in with the
results. If null, a new LatLonPoint will be allocated.null
if conversion failed. If you pass in a
LatLonPoint, it will be returned as well, if successful.public static int getZoneNumber(double lat, double lon)
lat
- in decimal degreeslon
- in decimal degreesCopyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details