Robust Geographical UTM Coordinate Parser

There are many ways to write geographical coordinates in UTM coordinate systems in the wild:

327874 12345
N 6730758 E 327874
6730758 N, -327874 W
e327874 n6730758
N6730758; E327874
x=327874 y=6730758
y:6730758;x:327874
...

It is not a trivial task to extract the numeric values from them. Therefore I created an open source Node.js package utm-coordinate-parser that manages exactly that, parsing the easting and northing values from the various formats.

Simple and robust textual coordinate input became a desirable feature in Georap GIS project. Users often want to input coordinates they have found in paper maps, info boards and books, as well as in forums and message boards. Universal Transverse Mercator (UTM) projections such as NZTM in New Zealand and ETRS89 TM35 in Finland are widely used in their respected zones and thus often faced on the field.

If Georap or any other end-user GIS application supports only single input format, users would have to convert their coordinates to it. Manual conversion can be a pain and especially so with tiny keyboards of mobile devices. For many travellers, mobile devices are the only possibility. Thanks to utm-coordinate-parser, users may type and even paste UTM coordinates successfully regardless the exact format.

Programmatic usage of the package is simple:

> const utm = require('utm-coordinate-parser')
> const position = utm.parse('N 12345 W 23456')
> position
{
  x: -23456,
  y: 12345
}

See the utm-coordinate-parser at NPM as well as axelpale/utm-coordinate-parser at GitHub for further details. For conversions from a coordinate system to another, see Proj4js and Proj.

For latitude and longitude flavoured parsing e.g. for WGS84, see coordinate-parser and magellan-coords. For related Q&A at StackOverflow see generic-javascript-parser-for-user-supplied-coordinates.

Akseli Palén
Hi! I am a creative full-stack web developer and entrepreneur with strong focus on building open source packages for JavaScript community and helping people at StackOverflow. I studied information technology at Tampere University and graduated with distinction in 2016. I wish to make it easier for people to communicate because it is the only thing that makes us one.

Leave a Comment

Your email address will not be published.