Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.50

Description

Description:Translates a Latitude / Longitude or MGRS coordinate into a VBS position.

Position formats for the different coordinate systems are:

  • MGRS: [grid,""] - Only the first element in the position array is used (for example, ["24SVJ0250082520",""]).
  • LL: [latitude,longitude] in degrees, as decimal number, followed by a space and the northern or western designator in uppercase (for example, ["39.58686 N","40.13539 W"]).
  • LLMS: [latitude,longitude] in degrees, minutes, seconds, followed by the northern or western designator in uppercase. Spaces between the arguments are optional (for example, ["39` 35' 13 N","40` 8' 7 W"]).
  • UTM: [zone,easting,northing], where "zone" is the zone number, followed by the hemisphere letter (N or S), and easting / northing are the X / Y positions, followed by the axis designator (mE or mN) (for example, ["24N","402500mE","4382520mN"]).
  • UTMB: [zone,easting,northing], where "zone" is the zone number, followed by the latitide band letter, and the easting / northing are the X / Y positions, followed by the axis designator (mE or mN) (for example, ["24T","398000mE","4629519mN"]).
  • BNG: ["BNG string", ""] (V3.8.1+)

Syntax

Syntax:coordToPos [position, coordinatesystem]
Parameters:
  • position: Array - Position in format appropriate for coordinate system (see above).
  • coordinatesystem: String - Coordinate system code as listed in the description above. if the string is empty, or an undefined system name (not one of the formats in the command description), then "MGRS" is used.
Return Value:Position3D - [x,y,z], where z is always 0.

Examples

Examples:Any of the following examples return a position closest to [2500, 3000]:
coordToPos [["24SVJ0250082520",""],"MGRS"]
coordToPos [["39.58686 N","40.13539 W"],"LL"]
coordToPos [["39` 35' 13'' N","40` 8' 7'' W"],"LLMS"]
coordToPos [["24N","402500mE","4382520mN"],"UTM"]
coordToPos [["24S","402500mE","4382520mN"],"UTMB"]
coordToPos [["ST 1000 1000",""],"BNG"]

Additional Information

See also: posToCoord, getOrigin, setOrigin, gridToPosition, fn vbs validateGPSCoord, fn vbs validateCoords, MGRS, UTM
Multiplayer:
Problems:

Notes

Posted on Nov 4, 2011
Richard Kissel
Use of the "UTM" and "UTMB" require versions greater than 1.50 to return this data