Class: Geom::UTM

Inherits:
Object
  • Object
show all

Overview

Note:

Valid ranges for #zone_number and #zone_letter are 1-60 and C-X (omitting I and O). Valid ranges for #x and #y are 100000-899999.

The UTM class lets you work with UTM map coordinates.

Version:

  • SketchUp 6.0

Instance Method Summary # collapse

Constructor Details

#initialize(zone_number, zone_letter, x, y) ⇒ Geom::UTM #initialize(utm) ⇒ Geom::UTM #initialize(array) ⇒ Geom::UTM

The #initialize method is used to create a new UTM coordinate. You will often create UTM objects by calling the method Sketchup::Model#point_to_utm instead of calling this method.

Examples:

# Create a copy of an existing UTM object.
utm = Geom::UTM.new(utm2)

# Create a new UTM object from scratch.
utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)

Overloads:

  • #initialize(zone_number, zone_letter, x, y) ⇒ Geom::UTM

    Parameters:

    • zone_number (Integer)

      A zone number or a UTM object.

    • zone_letter (String)

      A zone letter.

    • x (Float)

      The x position.

    • y (Float)

      The y position.

  • #initialize(utm) ⇒ Geom::UTM

    Parameters:

  • #initialize(array) ⇒ Geom::UTM

    Parameters:

    • An (Array(Integer, String, Float, Float))

      array containing the zone number, zone letter, x and y positions.

Version:

  • SketchUp 6.0

Instance Method Details

#to_aArray(Integer, String, Float, Float)

The #to_a method returns a UTM coordinate as a 4 element array. The Array elements are the zone number, the zone letter, the x coordinate and the y coordinate.

Examples:

# Create a new UTM object from scratch.
utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
a = utm.to_a

Returns:

Version:

  • SketchUp 6.0

#to_latlongGeom::LatLong

The #to_latlong method is used to convert UTM coordinates to latitude and longitude. See the LatLong class for more information.

Examples:

# Create a new UTM object from scratch.
utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
ll = utm.to_latlong

Returns:

Version:

  • SketchUp 6.0

#to_sString

The #to_s method is used to retrieve a string representation of a UTM.

Examples:

# Create a new UTM object from scratch.
utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
string = utm.to_s

Returns:

Version:

  • SketchUp 6.0

#xFloat

The #x method returns the UTM x coordinate.

Examples:

# Create a new UTM object from scratch.
utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
x = utm.x

Returns:

  • (Float)

Version:

  • SketchUp 6.0

#yFloat

The #y method returns the UTM y coordinate.

Examples:

# Create a new UTM object from scratch.
utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
y = utm.y

Returns:

  • (Float)

Version:

  • SketchUp 6.0

#zone_letterString

The #zone_letter method returns the UTM zone letter.

Examples:

# Create a new UTM object from scratch.
utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
zl = utm.zone_letter

Returns:

Version:

  • SketchUp 6.0

#zone_numberInteger

The #zone_number method returns the UTM zone number.

Examples:

# Create a new UTM object from scratch.
utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
zn = utm.zone_number

Returns:

  • (Integer)

Version:

  • SketchUp 6.0