A few weeks ago, I started looking round for some code/examples that I could use in Xojo, to assist with converting UK (OSGB36) National Grid co-ordinates to international (WGS84) standards. It didnt go well. I found examples written in c but they were not well documented or complete and were therefore unusable. I even submitted a request for a Xojo developer to write the code as I was willing to pay, but alas no takers there either.
I then set about writing the code myself; this app is the result of that.
The brief was very simple; convert UK Eastings and Northings to Latitude/Longitude values and then further convert them to WGS84 standard. The longer term plan is for these to be used as input to a vehicle routing engine.
Ordnance Survey UK has a very good pdf document titled ‘A Guide To Coordinate Systems In Great Britain’, 48 pages, which explains many different coordinate systems, the limitations of each and provides some very long and detailed conversion algorithms. Reading them on paper made my head spin a lot.
With the help of that document and a very helpful chap at Ordnance Survey who sent me some test data, I have now coded all the routines in a small Xojo app. The interface is very simple and also shows a table of all the test data together with the expected results, as seen here:
The app not only contains the routines I needed, but every single one that was detailed in the document mentioned above, which allows for all manner of conversions. All of the routines use the required double precision arithmetic and work on radian values, after which they are converted back to decimal degree values and DMS+Direction.
For anyone who has read this document or knows about the conversions that are required, its a lot of work; it took many attempts to get it right. Here is a list of the routines included :
The ouput of every function has been tested and verified, and they are all contained within a module which can obviously be imported should anyone want to use them.
As my little contribution to the Xojo community, I’m making the app, including source code, freely available to anyone who wants it. Drop me a PM with email so I can send it; alternatively if anyone wishes to host the source code, then let me know.