public class UTM extends java.lang.Object implements MapProjection
Modifier and Type | Field and Description |
---|---|
static int |
FROM_LAT_LONG
Indicates a transformation from longitude/latitude
|
static int |
TO_LAT_LONG
Indicates a transformation to longitude/latitude
|
Constructor and Description |
---|
UTM(Ellipsoid ellipsoid,
float lat,
float lng)
Initialises the UTM converter with the given ellipsoid.
|
UTM(Ellipsoid ellipsoid,
int zoneNumber,
char zoneLetter)
Initialises the UTM converter with the given ellipsoid and zone.
|
Modifier and Type | Method and Description |
---|---|
boolean |
doInterpolation()
Indicates whether the transformation should use nearest neighbour (false)
or some interpolator (true).
|
java.lang.String |
getDescription()
Provides a general description of the transformation.
|
Ellipsoid |
getEllipsoid()
Reports the ellipsoid used in the transformation.
|
java.lang.String |
getZone()
Reports the full UTM zone of currently used by the projection.
|
char |
getZoneLetter()
Reports the UTM zone letter currently used by the projection.
|
int |
getZoneNumber()
Reports the UTM zone currently used by the projection.
|
processing.core.PVector |
invTransformCoords(processing.core.PVector p)
Performs an inverse UTM transform on the given location.
|
processing.core.PVector |
latLongToUTM(processing.core.PVector p)
Converts the given (
lat ,lng ) coordinates into a UTM location. |
processing.core.PVector |
latLongToUTM(processing.core.PVector p,
double lngOrigin,
double latOrigin,
double xOffset,
double yOffset,
double scaleFactor)
Converts the given (
lng ,lat ) coordinates into a UTM location using
the given scale factor and origins. |
void |
setInterpolation(boolean doInterpolation)
Sets whether the transformation should use nearest neighbour (false)
or some interpolator (true).
|
void |
setZone(float lat,
float lng)
Sets the UTM zone determined by the given (
lat ,lng ) location. |
void |
setZone(int zoneNumber,
char zoneLetter)
Sets the zone number and letter for subsequent transformations.
|
processing.core.PVector |
transformCoords(processing.core.PVector p)
Performs a forward transform on the given location.
|
processing.core.PVector |
UTMToLatLong(processing.core.PVector p)
Converts the given UTM coordinates into a longitude/latitude location.
|
processing.core.PVector |
UTMToLatLong(processing.core.PVector p,
double lngOrigin,
double latOrigin,
double xOffset,
double yOffset,
double scaleFactor)
Converts the given UTM coordinates into a (
lng ,lat ) referenced location. |
public static final int FROM_LAT_LONG
public static final int TO_LAT_LONG
public UTM(Ellipsoid ellipsoid, int zoneNumber, char zoneLetter)
ellipsoid
- to use in projection.zoneNumber
- Zone number of UTM projection.zoneLetter
- Zone letter of UTM projection.public UTM(Ellipsoid ellipsoid, float lat, float lng)
ellipsoid
- to use in projection.lat
- Initial latitude coordinate.lng
- Initial longitude coordinate.public processing.core.PVector transformCoords(processing.core.PVector p)
transformCoords
in interface MapProjection
p
- Point coordinates to transform.public processing.core.PVector invTransformCoords(processing.core.PVector p)
invTransformCoords
in interface MapProjection
p
- Point coordinates to transform.public java.lang.String getDescription()
getDescription
in interface MapProjection
public boolean doInterpolation()
public void setInterpolation(boolean doInterpolation)
doInterpolation
- True if transformation should perform some local interpolation.public processing.core.PVector latLongToUTM(processing.core.PVector p)
lat
,lng
) coordinates into a UTM location.
longitude/latitude should be in decimal degrees with positive North and positive East.
The UTM zone to use should already have been set though the
constructor or a call to setzone()
.p
- Longitude/latitude point. Longitude varies within +-180 degrees, latitude within +-90 degrees.public processing.core.PVector latLongToUTM(processing.core.PVector p, double lngOrigin, double latOrigin, double xOffset, double yOffset, double scaleFactor)
lng
,lat
) coordinates into a UTM location using
the given scale factor and origins.
longitude/latitude should be in decimal degrees with positive North and positive East.
This version of the conversion does not require a UTM zone to be set
as the origin is set explicitly.p
- Longitude/latitude point. Longitude varies within +-180 degrees, latitude within +-90 degrees.lngOrigin
- Origin longitude (+-180.0).latOrigin
- Origin latitude (+-90.0).xOffset
- UTM coordinate X origin.yOffset
- UTM coordinate Y origin.scaleFactor
- Scale factor on central meridian used in transformation.public processing.core.PVector UTMToLatLong(processing.core.PVector p)
p
- Location of point as an easting and northing in the UTM projection (metres from local origin).public processing.core.PVector UTMToLatLong(processing.core.PVector p, double lngOrigin, double latOrigin, double xOffset, double yOffset, double scaleFactor)
lng
,lat
) referenced location.
Longitude/latitude will be in decimal degrees with positive North and positive East.
This transformation is independent of the UTM zone defined by the
constructor since all parameters are given explicitly.p
- Location of point as an easting and northing in the UTM projection (metres from local origin).lngOrigin
- Origin longitude (+-180)latOrigin
- Origin latitude (+-90)xOffset
- UTM coordinate X origin.yOffset
- UTM coordinate Y origin.scaleFactor
- Scale factor on central meridian used in transformation.public void setZone(float lat, float lng)
lat
,lng
) location.
Numbers vary from 1 to 60, where 1 is around 175W, and 60 is 175E. Letters vary
from N,M,O...X going north from equator and M,L,K...C going south from
equator.lat
- Latitude (+-90)lng
- Longitude (+-180)public void setZone(int zoneNumber, char zoneLetter)
zoneNumber
- Zone number to use.zoneLetter
- Zone letter to use.public int getZoneNumber()
public char getZoneLetter()
public java.lang.String getZone()
public Ellipsoid getEllipsoid()