coord#

coord provides conversions between the various coordinate systems used by DCS: the flat map (Lo) coordinate system, geographic latitude/longitude, and MGRS grid references.

Functions#

coord.LLtoLO(latitude, longitude, altitude)#

Converts geographic latitude/longitude (and optional altitude) into the flat map {x, y, z} coordinate system used by most other API points.

Parameters:
  • latitude (number) – Latitude, in decimal degrees.

  • longitude (number) – Longitude, in decimal degrees.

  • altitude (number) – Optional altitude, in meters.

Returns:

A {x, y, z} point.

Return type:

table

coord.LOtoLL(point)#

Converts a flat map {x, y, z} point back into latitude, longitude, and altitude.

Parameters:

point (table) – A {x, y, z} point.

Returns:

Latitude, longitude, and altitude.

Return type:

number, number, number

coord.LLtoMGRS(latitude, longitude)#

Converts latitude/longitude into an MGRS grid reference table.

Parameters:
  • latitude (number) – Latitude, in decimal degrees.

  • longitude (number) – Longitude, in decimal degrees.

Returns:

An MGRS grid reference table.

Return type:

table

coord.MGRStoLL(mgrsTable)#

Converts an MGRS grid reference table back into latitude and longitude.

Parameters:

mgrsTable (table) – An MGRS grid reference table.

Returns:

Latitude and longitude, in decimal degrees.

Return type:

number, number

Footnotes#

  • Most API functions that accept or return positions (e.g. in land, atmosphere, or class member functions) use the flat map coordinate system, not latitude/longitude. Use coord to convert whenever you need to present positions to the user or accepting geographic input.