The hcoord package

[Tags:bsd3, library, program, test]

Please see

[Skip to Readme]


Dependencies base (==4.*), hcoord, mtl, regex-pcre [details]
License BSD3
Copyright copyleft
Author Daniele Francesconi
Category geography
Home page
Source repository head: git clone
Uploaded Mon Mar 13 19:32:55 UTC 2017 by dfrancesconi
Distributions NixOS:
Downloads 24 total (9 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2017-03-13 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for hcoord

Readme for hcoord-


feed Build Status Note that this repo is a translation of the 2006 Jcoord project to Haskell.

Original Project Homepage ##

Conversion between latitude/longitude and grid references is not as simple as one would expect. Indeed, the maths involved is rather complex and not really for the faint-hearted! I have created a Java package which provides a simple API to allow conversion between OSGB (Ordnance Survey of Great Britain) grid references, UTM (Universal Transverse Mercator) references and latitude/longitude. OSGB Grid references can be returned as a standard six-figure grid reference using the 100km grid square letters (e.g. SK619847). Note: it is now possible to obtain an eight-figure grid reference as from release 1.2. The Jcoord script also contains a method to allow the calculation of the surface distance between two points of latitude/longitude. Looking for the same thing but with JavaScript or PHP? Translations of this package with the same functionality are available for JavaScript (see JScoord) and PHP (see PHPcoord). Information on converting between UTM and latitude/longitude is available at The Ordnance Survey have published a concise guide on converting between OSGB and latitude/longitude which is available at Bear in mind that Jcoord is still in development, so check back often for updates. To contact me about Jcoord, send an e-mail to

 (c) 2006 Jonathan Stott
 Created on 11-Feb-2006

Jcoord is a collection of Java classes that provide functions for handling
various co-ordinate systems and converting between them. Currently, OSGB
(Ordnance Survey of Great Britain) grid references, UTM (Universal Transverse
Mercator) references and latitude/longitude are supported. A function is 
also provided to find the surface distance between two points of latitude
and longitude.

When using the OSGB conversions, the majority of applications use the
WGS84 datum rather than the OSGB36 datum. Conversions between the two
data were added in v1.1 - the conversions should be accurate to within
5m or so. If accuracy is not important (i.e. to within 200m or so),
then it isn't necessary to perform the conversions.

Examples of how to use the classes in Jcoord can be found in the class

See for latest releases and information.


Accuracy of the co-ordinate conversions contained within the Jcoord
package is not guaranteed. Use of the conversions is entirely at your
own risk and I cannot be held responsible for any consequences of
errors created by the conversions. I do not recommend using the package
for mission-critical applications.


This software product is available under the GNU General Public License
(GPL). Terms of the GPL can be read at
Any commercial use requires the purchase of a license - contact me at for details.


 1.1 -
  - Added Junit unit test suite in the package.
  - Added NotDefinedOnUTMGridException which is thrown whenever an attempt is
    made to convert a LatLng object to a UTMRef object where the latitude falls
    outside the defined UTM grid.
  - Can format a latitude/longitude into a String in degrees-minutes-seconds
  - Added a class for Military Grid Reference System (MGRS) to allow for
    conversrions between MGRS and UTM and latitude/longitude.
  - Documentation (javadoc) improvements.
  - LatLng.getLat() has been deprecated. Use LatLng.getLatitude() instead.
  - LatLng.getLng() has been deprecated. Use LatLng.getLongitude() instead.
  - LatLng constructor now validates parameters and throws an
    IllegalArgumentException if either the latitude or longitude are invalid.
  - UTMRef(double,double,char,int) constructor has been deprecated and
    replaced with UTMRef(int,char,double,double). This is to make the order of
    the parameters more sensible.
  - Fixed slight error with values for converting between WGS84 and OSGB36.
  - New method: LatLng.distanceMiles(LatLng) to calculate the distance between
    two points of latitude/longitude in miles.
  - New constructors in LatLng to allow for specifying a datum and/or the
    latitude and longitude as degrees/minutes/seconds.
  - Added IrishRef class to allow conversion between latitude and longitude and
    Irish National Grid References.
  - Added new package with a number of data that
    all extend
  - Added new package with a number of definitions
    of reference ellipsoids that all extend
  - Fixed slight errors in OSRef to LatLng conversions.
 1.0 - 11 Feb 2006
  - Initial version created from PHPcoord v2.2.