Osgb
Library for converting between OSGB and WGS84 coordinates
Install / Use
/learn @dstl/OsgbREADME
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.
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
