UTM

class UTM

Parent: Object | Class Index
Methods:new, to_a, to_latlong, to_s, x, y, zone_letter, zone_number |
Sample Code: |

The UTM class lets you work with UTM map coordinates.

Class Methods

new
The new method is used to create a new UTM coordinate.
Syntax:
utm = Geom::UTM.new zone_number, zone_letter, x, y utm = Geom::UTM.new utm2
Arguments:
Return Value:
utm - a utm coordinate if successful
Comments:
You will often create UTM objects by calling the method point_to_utm. The second variation makes a new UTM object that is a copy of the first.
Example:

utm = Geom::UTM.new 13, "T", 475849.37521, 4429682.73749
if (utm)
UI.messagebox utm
else
UI.messagebox "Failure"
end

Instance Methods

to_a
The to_a method is used to convert a UTM coordinate into a 4 element array.
Syntax:
array = utm.to_a
Arguments:
Return Value:
array - a Array object with 4 elements if successful
Comments:
Example:

utm = Geom::UTM.new 13, "T", 475849.37521, 4429682.73749
a = utm.to_a
if (a)
UI.messagebox a
else
UI.messagebox "Failure"
end

to_latlong
The to_latlong method is used to convert UTM coordinates to latitude and longitude. See also LatLong.
Syntax:
latlong = utm.to_latlong
Arguments:
Return Value:
latlong - a latitude and longitude if successful
Comments:
Example:

utm = Geom::UTM.new 13, "T", 475849.37521, 4429682.73749
latlong = utm.to_latlong
if (latlong)
UI.messagebox latlong
else
UI.messagebox "Failure"
end

to_s
The to_s method is used to retrieve a string representation of a UTM.
Syntax:
string = utm.to_s
Arguments:
Return Value:
string - a string representation of the UTM
Comments:
Example:

utm = Geom::UTM.new 13, "T", 475849.37521, 4429682.73749
s = utm.to_s
if (s)
UI.messagebox s
else
UI.messagebox "Failure"
end

x
The x method is used to retrieve the X coordinate.
Syntax:
x = utm.x
Arguments:
Return Value:
x - the X coordinate if successful
Comments:
Example:
utm = Geom::UTM.new 13, "T", 475849.37521, 4429682.73749 x = utm.x

y
The y method is used to retrieve the Y coordinate.
Syntax:
y = utm.y
Arguments:
Return Value:
y - the Y coordinate if successful
Comments:
Example:
utm = Geom::UTM.new 13, "T", 475849.37521, 4429682.73749 y = utm.y

zone_letter
The zone_letter method is used to retrieve the UTM zone letter.
Syntax:
zoneletter = utm.zone_letter
Arguments:
Return Value:
zoneletter - the UTM zone letter if successful
Comments:
Example:
utm = Geom::UTM.new 13, "T", 475849.37521, 4429682.73749 zoneletter = utm.zone_letter

zone_number
The zone_number is used to retrieve the UTM zone number.
Syntax:
zonenumber = utm.zone_number
Arguments:
Return Value:
zonenumber - the UTM zone number if successful
Comments:
Example:
utm = Geom::UTM.new 13, "T", 475849.37521, 4429682.73749 zonenumber = utm.zone_number