This is a component that can be called from Visual Basic, C#, or whatever, that will convert from OSGB grid references to Latitude and Longitude.
This uses the OSGB36 to WGS84 Helmert Transform, something that old versions of MapPoint do not.
Run it standalone:
Enter the OSGB grid reference of your favourite roundabout. Click "Convert." You can then:
1, Parses the OSGB grid reference, and if valid...
2, Calculates the ellipsoidal Latitude and Longitude. (MapPoint stops here!)
2, Converts to 3-D Cartesian, using OSGB36 constants
3, Performs a Helmert transformation from OSGB36 to WGS84
4, Converts from 3-D Cartesian to WGS84 Latitude and Longitude.
I'm using algorithms published by the Ordnance Survey that are accurate to within 5 metres.
I may be persuaded to use the OSTN97 specification that give 20cm accuracy. Time will see.
1, Download it. This zip file contains the OCX control, and a type library.
2, Run the application. This will let you test it, as well as automatically registering the OCX.
3, Test it from VB. Here' s some sample code:
Private Sub Command1_Click()
Set o = CreateObject("LED_OSGB_POS.Application")
o.convert "SP 84000 35550"
Text1.Text = o.Latitude
Text2.Text = o.Longitude
You will now be able to programmatically convert from familiar OSGB references to the world of MapPoint.
(You may need to add a "dim o as object" depending on the version of VB.)
There is no OCX. The LED_OSGB_POS.exe registers itself when you run it stand alone.
The type library is required for VC++. Here's some VC++ samples using the control.
Test it here and now running on this IIS web server. ASP source. (Com object to be installed! Please wait!)
There's another example of using this control here.
To the Mapping page...
You may examine the source. The juicy bits are in OSGB_to_LL.CPP. You will need the algorithms published by the Ordinance Survey to understand it.
I have source for the reverse calculation, lat long to OSGB, here.
Email me if you have any questions.