Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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


I also know that the Eastings, Northings for the postcode is:-


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

Can anyone help?

EDIT Thanks for your help so far guys, I am starting to learn something here esp. the terminology...

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?


Thanks to all that answered, I finally got led to here which I can confirm works great

share|improve this question

migrated from stackoverflow.com Jun 28 '11 at 14:35

This question came from our site for professional and enthusiast programmers.

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. –  Daniel Pryden Apr 17 '10 at 0:12
@all have posted an edit with a link showing the desired results and the projection used –  Rippo Apr 17 '10 at 6:28
add comment

4 Answers 4

up vote 6 down vote accepted

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.

share|improve this answer
@mtrw have posted an edit with a link showing the desired results and the projection used –  Rippo Apr 17 '10 at 6:29
Thanks for your input, I have learnt alot from this... See my answer –  Rippo Apr 17 '10 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 Apr 17 '10 at 8:29
For a C# answer check out this question stackoverflow.com/questions/1867950/… –  MarkJ Apr 18 '10 at 18:07
add comment

The C# part of this question is a duplicate of Is there a free .Net library to convert OSGB36 to WGS84? The answers list two free libraries.

share|improve this answer
add comment

Here's a reference.

share|improve this answer
Crikey, that spreadsheet looks scary, I was hoping for x = y * 2! –  Rippo Apr 16 '10 at 19:28
@rippo A simple approximation algorithm could probably be obtained by taking the average values for each of those various equatorial / polar radii and flattening values, but an approximation would be all it is. The earth is neither a perfect sphere nor even radially symmetrical at the levels of precision implied by the number of significant digits you use in your example. –  Jherico Apr 16 '10 at 19:33
Viewing the source for Dan's page should be what you're after for the JS part. –  John Apr 16 '10 at 19:42
I have tried dans suggestion but cannot get the results that I expect, Obviously I do not understand what it is I am asking for but I do know the numbers I gave are correct. –  Rippo Apr 16 '10 at 20:35
@all have posted an edit with a link showing the desired results and the projection used –  Rippo Apr 17 '10 at 6:29
add comment

Is this for UTM zone northing/eastings? I wrote a utility for that in javascript:


share|improve this answer
Nice work! Why no AdSense on that page? ;) –  John Apr 16 '10 at 19:44
Excellant, will have a look at this. –  Rippo Apr 16 '10 at 20:21
@dan I have tried this but cannot get the expected results. Obviously there is something that I do not understand. –  Rippo Apr 16 '10 at 20:33
This is the original code I used to get the idea: home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html I had to modify the code for my company, but it's generally the same idea. @John: Probably because my corporate hq would have a fit if they saw ads on their site. –  Dan Apr 16 '10 at 20:54
Rippo, I think you need to establish which type of projection those numbers are coming from. The "easting and northing" numbers are the result of the geographic coordinates being converted to a certain type of projection standard. They all have different algorithms, so I just threw out UTM because that's what I assumed you're using. Figure out the projection method, and then we can find the correct formula for you. UTM usually has a certain zone number associated with the part of the globe you are working with, so if you don't have that zone number, it's probably not utm. –  Dan Apr 16 '10 at 21:08
show 2 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.