Skip to content

Instantly share code, notes, and snippets.

@neebz
neebz / convertToLatLongFromEastings
Last active December 16, 2015 18:59
An Objective-C method to convert British Grid Coordinates (Easting and Northings) to Longitude and Latitude. Converted from Hannah Fry's Python method: http://hannahfry.co.uk/2012/02/01/converting-british-national-grid-to-latitude-and-longitude-ii/
#include <math.h>
#include "CLLocation.h" //requires Core Location Framework
- (CLLocationCoordinate2D)convertToLatLongFromEastings:(double)E andNorthings:(double *)N {
//E, N are the British national grid coordinates - eastings and northings
double a = 6377563.396; //The Airy 180 semi-major and semi-minor axes used for OSGB36 (m)
double b = 6356256.909;
double F0 = 0.9996012717;