Accuracy With OSGB Grid References
Nick Hubbard investigates and supplies a solution for using OSGB coordinates accurately with MapPoint 2002
MapPoint has the OSGB coordinate system wrong!
That's a bold statement. What do I mean?
Introduction
When placing pushpins from within MapPoint I noticed that they were out by 120
metres. On further investigation this error only occurred if I had defined the location using OSGB
(Ordnance Survey of Great Britain) grid references.
Also there is no
automation interface for us poor Brits wanting to use our national mapping
coordinate system. We're obliged to use alien latitude and longitude.
Helmert Transform
The Earth is not a sphere. To cope with the irregular shape, British national maps use a coordinate system that best fits Britain only (Airy 1830). GPS and MapPoint
use the "World Geodetic System 1984" (WGS84) that best fits the whole Earth.
When MapPoint reads in our "Quaint, Little Old England" map references, it uses the WGS84 coordinate system without transforming to the Airy 1830 shape of the Earth.
The
coordinate system conversion is performed by matrix maths, the
aforementioned Helmert transform.
This is explained in A guide to coordinate systems in Great
Britain. Published by the Ordnance Survey. It's a very readable document.
Does this error matter?
That depends on how accurate you want to be. The error can be significant, up to 200 metres.
If you can use latitude and longitude, then the problem goes away: only OSGB
coordinates read in by MapPoint are in error.
But what do you do if your dataset is in OSGB coordinates? You can't use OSGB coordinates in automation - the MapPoint "GetLocation" method only takes
latitude and longitude.
Is there an solution?
Yes. I have implemented an OCX control that performs the WSG84 to OSGB Helmert transform. This reduces the error to within 5 metres.
What does the control do?
- Parses the OSGB grid reference, and if valid...
- Calculates the ellipsoidal Latitude and Longitude. (MapPoint stops here!)
- Converts to 3-D Cartesian, using OSGB36 constants
- Performs a Helmert transformation from OSGB36 to WGS84
- Converts from 3-D Cartesian to WGS84 Latitude and Longitude.
How to use it:
- Download it. This zip file contains the OCX
control.
- Run the application. This will let you test it, as well as automatically
register the OCX.
- Test it from VB.
Sample code:
Source
The source to the control is here.
Further Information
Visit http://www.anotherurl.com/mapping/default.htm
to read more.
Test the control here
and now running in an asp script on a IIS web server.
More samples in VC++
here.