Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easting / Northing to LatLon Accuracy #8

Closed
eldiddio opened this issue May 5, 2016 · 3 comments
Closed

Easting / Northing to LatLon Accuracy #8

eldiddio opened this issue May 5, 2016 · 3 comments

Comments

@eldiddio
Copy link

eldiddio commented May 5, 2016

Hi,

I have been using this class to convert a bunch of Easting / Northing, I found when checking the converted values against a map that the LatLng was slightly off.

When the results where compared against a online tool for I noticed that the only difference was the length of the results.

To test this I adjusted LatLng.php

$this->lat = round($lat, 5);
$this->lng = round($lng, 5);
to
$this->lat = round($lat, 13);
$this->lng = round($lng, 13);

This changes moved the point on the map by about 100 meters and was more accurate.

Does the class support getting LatLng out in a longer format?

Thanks for the great work!

@eldiddio
Copy link
Author

eldiddio commented May 5, 2016

A follow up to this, when I run

new OSRef(533498, 181201))->toLatLng()

Results: 51.51346, -0.07592,

This is close but not accurate when checking with Google Maps. When I use this form http://www.bgs.ac.uk/data/webservices/convertForm.cfm

Results: 51.5139688159, -0.0775306313912

The results from the form are different and accurate, do I need to change the way i load the class to get accurate results?

Thanks Again!

@dvdoug
Copy link
Owner

dvdoug commented May 5, 2016

Hi

So there are a few issues at play here - in the below I'm going to assume you're not familiar with any of the intricacies of geographic co-ordinates and I'll dumb it down a bit in the interests of brevity. A fuller explanation of everything can be found in https://www.ordnancesurvey.co.uk/docs/support/guide-coordinate-systems-great-britain.pdf

Basically:

  • 5dp latitude/longitude represents an accuracy of about 1m. 6 dp would be an accuracy of about 10cm, and 13dp would claim to represent sub-millimetre accuracy
  • the Earth is not perfect sphere or ellipsoid - it's bumpy and lumpy
  • as such, when doing the maths an approximation is used to try and use an ellipsoid shape that "best fits" the planet
  • there is no single correct best fit - in the UK, Ordnance survey modelling uses an ellipsoid that best fits the way the UK is placed on the planet
  • when the GPS people did their modelling they used a different ellipsoid that better fits most of the planet, but doesn't fit the UK quite as well
  • as such, depending on which model you use the same set of lat/long numbers actually represent a different spot on the ground
  • there are ways to convert between the various models (UK to GPS), but without huge databases of surveying data to back them up they're not perfect - purely algorithmic conversion results in small errors of up to 5m (which is good enough for most purposes)

Conclusions:

  • since the output of any modelling conversion is going to have an error of up to 5m, the choice to round to 5dp (1m) is on purpose - otherwise the results will be off when compared to e.g. a direct GPS reading.
  • when you convert from northing/easting to lat/long you're still in the UK model of the world as used by OS. However Google maps is almost certainly using the GPS model. If you do ->toLatLng()->toWGS84() you'll get the set of co-ordinates that I think you're expecting.

Hope that helps?
Doug

@dvdoug
Copy link
Owner

dvdoug commented May 16, 2016

Assuming this helped you out - if not, please do reopen :)

@dvdoug dvdoug closed this as completed May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants