Closed davegurnell closed 9 years ago
Hoist by my own petard! I emphasised in my explanations that a grid reference is a square, not a point, but then went on to treat a 10-digit grid reference as a point, rather than as a 1-metre square.
I've corrected OsGridRef.osGridToLatLon to convert to the centre of the 1m grid square (and added a round-trip check to the test harness). Round-trip conversion of TQ 44359 80653 now works.
Thanks for pointing that out.
I've not been able to replicate any further problems.
Chris
Hi Chris,
Thanks for this library - it's been very useful.
I've come up with some erroneous behaviour and I wanted to check if it's a bug or my mistake.
The original issue came when I noticed that I was converting a National Grid Reference to a WGS84 and back again and came up with the wrong answer. Here's the data:
I used a third party conversion site to get confirmation of the correct data -- it looks like the NGR -> WGS84 conversion is working fine and the WGS84 -> NGR conversion is in error:
I forked your geodesy codebase to add some tests. The behaviour I ended up with isn't consistent with the above but still deserves attention. See line 169 onwards here: https://github.com/davegurnell/geodesy/blob/master/test.js
These tests appear to reveal two bugs:
Can only convert OSGB36 point to OsGrid
. It looks like this is because there's nodatum
field in the locationfollowing conversion from WGS84.Can you provide any hint as to what's going on here? Am I using the library as intended?
It's test case 1 I'm primarily concerned about as I'm not familiar enough with the maths of coordinate conversion to help. I'm happy to provide a bug fix for test case 2 if required.
Best regards,
Dave