Code Monkey home page Code Monkey logo

Comments (3)

eldiddio avatar eldiddio commented on June 19, 2024

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!

from phpcoord.

dvdoug avatar dvdoug commented on June 19, 2024

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

from phpcoord.

dvdoug avatar dvdoug commented on June 19, 2024

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

from phpcoord.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.