Coord v0.1.0 Coord.Point.UTM View Source

A point represented by a hemisphere of the globe (north or south), one of sixty numbered 6 degrees of longitude wide zones, an easting, and a northing.

iex> use Coord
iex> _point = UTM.new(30, :n, 582_032, 5_670_370)
%Coord.Point.UTM{
  datum: %Coord.Datum{
    ellipsoid: %Coord.Datum.Ellipsoid{
      a: 6378137,
      b: 6356752.314245,
      f: 0.0033528106647474805
    }
  },
  e: 582032,
  hemi: :n,
  n: 5670370,
  zone: 30
}

By the way, the default values of the struct point to the same point at Stonehenge as the default values of the Coord.Point.LatLng struct for testing purposes.

Concept

You may see UTM coordinates which specify hemispheres with the letter N or S, or you may see them specify an MGRS band instead. This library chooses to specify UTM coordinates with a hemisphere and provide the function Coord.Point.UTM.mgrs_band/1 to compute the band. There are 20 MGRS bands each 8 degrees of latitude wide. They are numbered C to X, where C is the southmost and X is the northmost band. I and O are skipped to avoid mixing them up with the numbers 1 and 0. Unfortunately, this means it can be unclear whether a UTM coordinate uses the letter S to specify band S (which is in the northern hemisphere), or the southern hemisphere.

Zone one starts at the international date line (which passes between Russia and Alaska), and the zones count eastward (zone 2 is east of zone 1).

The easting counts the number of meters a point is east of the false origin, a line 500,000 meters west of the central meridian of the zone. A point 100m east of the central meridian of the zone would have an easting of 500_000 + 100 = 500_100, and a point 100m west of the central meridian of the zone would have an easting of 500_000 - 100 = 499_900. The east-west distance between those two eastings can be calculated by finding the difference between them (500_100 - 499_900 = 200). An easting is always a six digit number.

In the northern hemisphere the northing counts the number of meters a point is north of the equator, while in the southern hemisphere it counts the number of meters a point is north of a line 10,000,000 meters south of the equator. That definition ensures if point A is north of point B point A will always have a larger northing. A northing is always a number with between one and seven digits.

A datum represents the approximation used to fit a grid system onto our irregularly shaped world.

For an more detailed explanation of UTM and examples of how UTM coordinates can be abbreviated see (Geokov)[http://geokov.com/education/utm.aspx].

Source: http://geokov.com/education/utm.aspx

Link to this section Summary

Types

Hemisphere

t()

A struct containing a UTM point.

UTM Zone

Functions

Create an UTM point from a LatLng point.

Create an UTM point from a LatLng point, overriding the correct zone with a different zone.

Returns the MGRS band an UTM coordinate is in.

Create a new UTM point from a zone, hemisphere, easting, northing, and optional datum

Link to this section Types

Specs

hemi() :: :n | :s

Hemisphere

The N in 30 N 582032 5670370

Specs

t() :: %Coord.Point.UTM{
  datum: Coord.Datum.t(),
  e: float(),
  hemi: hemi(),
  n: float(),
  zone: zone()
}

A struct containing a UTM point.

Keys:

  • :zone: UTM Zone. The 30 in 30 N 582032 5670370
  • :hemi: Hemisphere. The N in 30 N 582032 5670370
  • :e: Easting. The 582032 in 30 N 582032 5670370
  • :n: Northing. The 5825670370032 in 30 N 582032 5670370

Specs

zone() :: 1..60

UTM Zone

The 30 in 30 N 582032 5670370

Link to this section Functions

Link to this function

from(latlng, datum \\ Datum.wgs84())

View Source

Specs

Create an UTM point from a LatLng point.

iex> use Coord
iex> LatLng.new(51.178861, -1.826412) |> UTM.from()
%Coord.Point.UTM{
 datum: %Coord.Datum{
   ellipsoid: %Coord.Datum.Ellipsoid{
     a: 6378137,
     b: 6356752.314245,
     f: 0.0033528106647474805
   }
 },
 e: 582031.9577723305,
 hemi: :n,
 n: 5670369.804561083,
 zone: 30
}

Returns a Coord.Point.UTM.

Uses Karney's method. Accurate up to 5nm if the point is within 3900km of the central meridian.

Link to this function

from(lat_lng, datum, zone)

View Source

Specs

Create an UTM point from a LatLng point, overriding the correct zone with a different zone.

The zone specified will be used instead of the zone where the point lies. The exceptions for Norway/Svalbard will be applied to the zone specified. This means the code assumes that the zone specified was calculated without taking the exceptions into account.

See Coord.Point.UTM.from/2 for details.

Specs

mgrs_band(t()) ::
  :c
  | :d
  | :e
  | :f
  | :g
  | :h
  | :j
  | :k
  | :l
  | :m
  | :n
  | :p
  | :q
  | :r
  | :s
  | :t
  | :u
  | :v
  | :w
  | :x

Returns the MGRS band an UTM coordinate is in.

Concept

(MGRS)[https://en.wikipedia.org/wiki/Military_Grid_Reference_System] is a separate coordinate system similar to UTM. One aspect is that in addition to zones it also has bands start at A at the north pole go to Z at the south pole, skipping I and O because they could be confused with the numbers 1 and 0.

Despite being from a separate system some people write UTM coordinates with an MGRS band instead of a hemisphere, such as 30 U 582032 5670370 instead of 30 N 582032 5670370.

Link to this function

new(zone, hemi, e, n, datum \\ Datum.wgs84())

View Source

Specs

new(zone(), hemi(), float(), float(), Coord.Datum.t()) :: t()

Create a new UTM point from a zone, hemisphere, easting, northing, and optional datum