Geographic Library

The Problem

Many geospatial applications allow you to enter or to copy geographic coordinates. There are many reasons why a user may want to extract the latitude and longitude of a point from one program, and enter it into another program. For example, a user many need to text the information, email it or even say it over a phone line or radio.

People on the receiving end of this conversation need to be able to record the coordinate, and possible to enter it into another system such as a GIS, mapping program, emergency management software or a GPS.
Herein lies the problem: each program has it’s own way of handling the format of the data. Many software packages force you to choose a single display format for geographic coordinates and also rely on receiving input in that format. The problem occurs when the transmitter of data needs to reformat it to match what the receiver expect, or when the receiving party needs to reformat the data into what their software expects. This results in an error prone transmission of data that can result in catastrophic consequences.

Examples

As an example, here are seven different ways of reporting the same coordinate
     45:26:46N,     65:56:55W
     45:26:46.302N, 65:56:55.903W
     45°26'21"N,    65°58'36"W
     45N26 21,      65W58 36
     45.446195N,    65.948862W
     45.446195,     -65.948862
     N45° 26.7717', W65° 56.93172'

If a receiver needs to reformat Degrees, Minutes and Seconds (DMS) into Decimal degrees (or DD.DDDD) they either need to re-set the format their software requires to read the data, or perform some difficult base-60 math in their heads.

The Soution

The TrueNorth.Geographic library is BlueToque Software’s expression of a solution to this dangerous, and frankly negligent state of affairs in software.
The purpose of software is to take the tedious and error prone tasks away from users. Requiring a user to conform to a certain format when entering data is exactly that: tedious and error prone.
This library contains a several parsing methods that can take a Geographic coordinate entered in any one of the aboveformats and several more, and interpret them correctly. It also contains a data model for representing the data internally in a proper decimal format for precision, and methods for formatting the data for output and display.

Finally, it contains an implementation of part of ISO 6709 for transmitting geographic coordinates.

Download

  • Source (Visual Studio 2010 Solution)

Change Log

  • May 16 2010: first public release
  • December 2008: developed and used in test applications
  • December 2009: integrated into TrueNorth Mapping

License

This software and code are free, and are committed to the public domain in the hopes that better software can be made, and the easily avoidable situation of coordinate conversion is never built in to geospatial software again. Users can download, adapt, remix, port, compile and sell this software as much as they like.
This code is released WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. My name, or the name of BlueToque Software cannot be used to market or promote this software in any way without prior authorization in writing.