Giter Club home page Giter Club logo

osgb's Introduction

OSGB Library

Java library for converting OSGB (Ordnance Survey National Grid) references and standard Latitude-Longitude (WGS84) coordinates.

Usage

The following examples, taken from the unit tests, show how to use the library. For more example, refer to the unit tests.

Converting from WGS84 coordinates to OSGB

double[] latlon = OSGB36.fromWGS84(51.5085300, -0.1257400);
//latlon[0] = 51.508019, latlon[1] = -0.1241133

Converting from OSGB coordinates to WGS84

double[] latlon = OSGB36.toWGS84(51.5, 0.116667);
//latlon[0] = 51.500514, latlon[1] = 0.115033

Converting from OSGB Grid Reference to WGS84

//Convert to Easting and Northing
double[] eastingNorthing = NationalGrid.fromNationalGrid("NW 16234 34223");

//Convert from Easting and Northing into Cartesian Coordinates (LatLon)
double[] latlonOSGB38 = EastingNorthingConversion.toLatLon(
      eastingNorthing,
      Constants.ELLIPSOID_AIRY1830_MAJORAXIS,
      Constants.ELLIPSOID_AIRY1830_MINORAXIS,
      Constants.NATIONALGRID_N0,
      Constants.NATIONALGRID_E0,
      Constants.NATIONALGRID_F0,
      Constants.NATIONALGRID_LAT0,
      Constants.NATIONALGRID_LON0);
 
//Convert from LatLon (OSGB) to WGS84
double[] latlonWGS84 = OSGB36.toWGS84(latlonOSGB38[0], latlonOSGB38[1]);

Building and Releasing

To build this library, run the following Maven command:

mvn clean package

To release this library to Maven central, run the following command:

mvn deploy -P release

Then log in to Nexus Repository Manager, close the staging repository and then release.

osgb's People

Contributors

jbaker-dstl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

osgb's Issues

OSGB36.toWGS84 uses the wrong ellipsoid

I may be wrong here as coordinate math isn't my strength, but I believe the current implementation of OSGB36.toWGS84 is incorrect. In my testing converting to an OSNG string and back to a WGS84 coordinate did not present the same value as the original WGS84 coordinate. I believe the issue is that the to and from ellipsoids are swapped; on my fork of this repo, I made the following change and it resolved the problem for me: kylecorry31@1df79ea

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.