14

I have the following UK postcode dy8 3xt and know that the latitude and longitude is:

54.452772
-2.156082

I also know that the Easting, Northing for the postcode is:

389490
283880

However I am struggling to find the equation that converts lat/long to Northing and Easting, I would prefer to have the equation in both in jScript and C# (I am being greedy)!

Can anyone help?

Some more info, if you click on this link you can see the results I am looking for. The postcode I entered projects to lat/lng using WG S84 and the grid ref projects to OSGB. So my question is how is this done?


I finally got led to here which I can confirm works great.

2
  • 3
    Do you know what coordinate system(s) you're using? "Easting and northing" are the standard names for the x and y coordinates in any projected (i.e. planar) coordinate system. Additionally, "latitude and longitude" are the standard names for the coordinates in any unprojected (i.e. geographic) coordinate system. You might be asking for a conversion from WGS84 to UTM, or maybe you want the British national grid system as mtrw suggests. In any case, the numbers by themselves are ambiguous unless you also know the coordinate system. Commented Apr 17, 2010 at 0:12
  • @all have posted an edit with a link showing the desired results and the projection used
    – Rippo
    Commented Apr 17, 2010 at 6:28

1 Answer 1

13

Edit - Update with OSGB36 specific information.

Well, the good news is that the target projection is OSGB36, which is a well known and standardized projection. The bad news is that GIS programming is still really difficult :)

There are a set of parameters that need to be defined, and mathematical operations applied to those parameters, to succesfully project lat/long to grids. Fortunately, there are databases of parameters for the former, and libraries for the latter. proj.4, which I mentioned earlier, is one of the standard libraries. There are also ports of proj.4 to other languages, including JavaScript, which is hopefully close enough to jScript for your purposes. The port is proj4js.

The other thing you need to know is the EPSG number for your coordinate systems. OSGB36 is EPSG:6277. The EPSG is an oil-industry (I think) created body that collected lots of locally defined projections and documented them. The database is now openly maintained, and GIS libraries can use their definitions.

Previous info

Your easting/northing numbers may be in the British national grid system.

I gave an answer to another GIS related question that includes links to proj.4, which is one of the standard libraries for converting between lat/long and easting/northing (the forward calculation is called projection in the GIS world). I've never used it for the conversion you're looking for, but the software is well-documented and comes with conversion definitions for lots of projections.

4
  • @mtrw have posted an edit with a link showing the desired results and the projection used
    – Rippo
    Commented Apr 17, 2010 at 6:29
  • Thanks for your input, I have learnt alot from this... See my answer
    – Rippo
    Commented Apr 17, 2010 at 8:23
  • @Rippo - Glad to have helped! GIS is really interesting. I recently left the job where I dabbled in that area, and I miss it a bit.
    – mtrw
    Commented Apr 17, 2010 at 8:29
  • For a C# answer check out this question stackoverflow.com/questions/1867950/…
    – MarkJ
    Commented Apr 18, 2010 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.