geoutm icon indicating copy to clipboard operation
geoutm copied to clipboard

Conversion between latitude/longitude coordinates to UTM

=NAME

GeoUtm

=SYNOPSIS

require 'geoutm'

coordinate = GeoUtm::LatLon.new 100.0, 100.0 to_utm = coordinate.to_utm and_back = utm_coord.to_lat_lon

=INSTALL

gem install geoutm

=DESCRIPTION

This gem translates between latitude and longitude coordinates to Universal Transverse Mercator(UTM) coordinates. The first kind is generally reported by GPS units, while the second is useful as they are represented in meters, thus making distance calculations easier.

For more information please refer to http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system

= EXAMPLES

A description of the available ellipsoids and sample usage of the conversion routines follows

== Ellipsoids

Ellipsoids describe the shape of the earth used to calculate the UTM grid. As a default, WGS-84 is selected, but any of the following ellipses may be used:

  1. Airy
  2. Australian National
  3. Bessel 1841
  4. Bessel 1841 Nambia
  5. Clarke 1866
  6. Clarke 1880
  7. Everest 1830 India
  8. Everest 1830 Malaysia
  9. Everest 1956 India
  10. Everest 1964 Malaysia and Singapore
  11. Everest 1969 Malaysia
  12. Everest Pakistan
  13. Fischer 1960 Mercury
  14. Fischer 1968
  15. GRS 1967
  16. GRS 1980
  17. Helmert 1906
  18. Hough
  19. Indonesian 1974
  20. International
  21. Krassovsky
  22. Modified Airy
  23. Modified Everest
  24. Modified Fischer 1960
  25. South American 1969
  26. WGS 60
  27. WGS 66
  28. WGS-72
  29. WGS-84

When specifying the ellipsoid as a parameter, you may use an instance of the GeoUtm::Ellipsoid class, a string containing the name above, or alternatively just a symbol (eg. :wgs84). The name is not case sensitive and symbols are allowed. Spaces and - are ignored.

== Latitude / longitude to UTM conversion

Latitude values in the southern hemisphere should be supplied as negative values (e.g. 30 deg South will be -30). Similarly Longitude values West of the meridian should also be supplied as negative values. Both latitude and longitude should not be entered as deg,min,sec but as their decimal equivalent, e.g. 30 deg 12 min 22.432 sec should be entered as 30.2062311

The ellipsoid value should correspond to one of the numbers above, e.g. to use WGS-84, the ellipsoid value should be 23

For latitude 57deg 49min 59.000sec North longitude 02deg 47min 20.226sec West

using Clarke 1866 (Ellipsoid 5)

utm = LatLon.new(57.803055556, -2.788951667).to_utm(Ellipsoid::lookup('clarke 1866'))

returns

 utm.zone  = 30V
 utm.e     = 512533.364651484
 utm.n     = 6409932.13416127

= AUTHOR

This gem is heavily inspired and to a large extent also copied directly from by the Perl library Geo::Coordinates::UTM written by Graham Crookham. Graham Crookham, [email protected]

Ruby port by Tallak Tveide, Erling Linde 2009/2011

= COPYRIGHT

Copyright (c) 2000,2002,2004 by Graham Crookham. All rights reserved.

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.