Solved

Convert Latitude & Longitude (Decimal) to Easting & Northing

Posted on 2004-04-23
17
85,381 Views
Last Modified: 2011-08-18
I need to convert Longitude and Latitude to Easting and Northing for locations in Australia, so our mapping engine can display them on a map. While the engine supports a single location using Latitude and Longitude, it requires eastings and northings if I want it to display more than one location at the same time.

I want to write a PHP script which can convert latitude to northing, and longitude to easting.

The script will be easy if I know the mathematical formula, I guess. Most of the places on the web that show the formula use complex looking squiggles and symbols, and I cant understand them, as i'm no mathemetician. Can anyone show me the equation to do this? I think it should be easy...
0
Comment
Question by:Dr_Snapid
  • 9
  • 7
17 Comments
 
LVL 25

Expert Comment

by:lwadwell
Comment Utility
not sure of the formula myself either...(but it looks reasonably complex)...below is a link to web site that does the conversions...it even has an Excel speadsheet you can download that does the conversions using Redfearn's formulae.

http://www.ga.gov.au/nmd/geodesy/datums/calcs.jsp#coords

hope it helps..
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
This link sounds relevant

   http://www.ga.gov.au/nmd/geodesy/datums/redfearn_geo_to_grid.jsp

It gives a link as well to

   http://www.icsm.gov.au/icsm/gda/index.html

Where you can find interesting data (see FAQs and Technical manuals)
0
 
LVL 1

Author Comment

by:Dr_Snapid
Comment Utility
Yes, there is alot of data there, but they still dont show me (at least not that I could see) a usable conversion equation that i could put in my script.

I think easting is meters east of 0deg at the equator, and northing is meters north of the equator (negative values for west and south, respectively) is that right?

I have thought of trying:
 Distance around earth at equator is 40,075,160 meters.
So Easting for 180deg LONGITUDE must be half this, correct?

Distance around earth pole to pole is 40,008,000 meters.
So Northing for 90deg LATITUDE must be 1/4 of this, correct?

Would the formulae below work?
EASTING=LONGITUDEx(40075160/360)
NORTHING=LATITUDEx((40008000/4)/90)

I understand that this may not take altitude and imperfections in earth's shape into account, but would this work with any degree of accuracy?

My first map will only be displayed 600 pixels wide, so i cant be amazingly accurate anyway.
0
 
LVL 10

Accepted Solution

by:
Mercantilum earned 75 total points
Comment Utility
Yes the link I gave above is not really friendly, while it should give specific data for Australia though.

Something more readable and pragmatic from  http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.HTM
Where you get as well the average radius of Earth for Australia, for instance.

You want UTM international system coordinates, the ones used by GPS for instance:

The problem is that Earth is neither completely spherical nor flat in term of altitude.
Therefore the formulas provided are really complex.
They provide some explanations about the UTM system http://www.uwgb.edu/dutchs/FieldMethods/UTMSystem.htm
where it is said that (among other things)
- start counting from zero at the equator (latitude) ; actually South pole is 0 up to 9999 for 1 km before equator, then zero again up to North pole
   -1km (9999), and the North pole is 0 again :)
   So you see that intrinsecally the Eearth NS is approximated to 20,000km (e.g. 40000km for the whole Earth)
- longitude: a bit more complex. The 360 degrees of longitude are divided into 60 zones of 6 degrees.
   Each zone meridian (e.g. 3 degrees) is - it is a convention - 500km (500000m).
   It starts from actually 180W (or -180E): divide by 6 and round up to upper number to get the Zone.

   So the UTM coordinates you will get are basically (x,z Eastern, +/-y Northern) where y is from 0 to 9999km and x is >0 and <1000km, z being the zone from 1 to 60. To get the actual coordinates UTM like please look again this http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.HTM.

This system, for the longitudes has the advantage, to my mind, to reduce largely the aspherical problem of the Earth, since your first get a zone which depends upon the longitude in degrees itself (not dependant of altitude or irregularities of Earth) then we are in a square of a few hundreds of km. Error is minimal.


So to summarize you don't have to use the complex math formula:

1. for longitude: convert your longitude to start from 180W, e.g. Lg = Lg + 180. (West being negative) So you get a Lg >=0 and < 360.
   Then divide by 6 and round up: e.g. 80W, would be 180-80 = 100.
    100/6 = 16.67, round up : 17. You are in zone 17. 100 modulo 6 = 4. So you are on the right side of the meridian of the zone 17!
    A degree is about 111km (40000/360), the center of the meridian is 3 degree, you have 4, you are 1 degree after the center of the zone ; so your coordinate in zone 17 should be 500+111 = 611. (I just checked against the calculator given below and it worked :)

2. for latitude it is simpler :)  Given the Earth radius R =~ 6366 km
   It should be something like for for
    North:   latitude * 2 * PI * R / 360.  
    South:  - (90 - latitude)  * 2 * PI * R / 360.  
    (latitude: North and South get 0 to 90 positive degrees in my formula) so that you get positive Northern or negative depending on N/S.
    E.g.  47N => Northern 47 * 2 * PI * R  / 360   =   5222 km
    E.g.  31S => Northern  -59 * 2 * PI * R  / 360 =  -6555 km
    (the calculator below will give you a slight different result as it uses the math formula :)

   So you get your (lat,long) = (31S, 80W)  => UTM (Northern -6555, Eastern 611km zone 17)

You can check your guesses against this (choose International UTM) http://www.ngs.noaa.gov/cgi-bin/utm_getut.prl (in metres)
   (enter for instance  N171234.0000 for latitude north 17 degrees 12' 34" and W0811234 for west 081 degrees 12'34")

Last thing if you think about using formulas given in links: beware degrees are usually given in Radians !!

A more math-like formula: http://www.tandt.be/wis/WiS/eqn2tf.html
0
 
LVL 1

Author Comment

by:Dr_Snapid
Comment Utility
It looks like all the info i need to complete my task is available to me now, through the very good post by Mercantilum. The links are also useful. Cheers guys.
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
Hi :)
How did your program go finally?
0
 
LVL 1

Author Comment

by:Dr_Snapid
Comment Utility
Very well thankyou, Merc. Now we can plot multiple points using Lat & Long, so i dont need to use easting and northing anymore, greatly simplifying my script. I know that I would have been able to use multiple points by doing a easting and northing conversion though, thanks to the help I got in this thread.
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
Cool :)
By the way I thought my investigation deserved better than a 'B' ...
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 1

Author Comment

by:Dr_Snapid
Comment Utility
It was great information you provided, the only reason I gave you a B was because I read the suggested scoring (this was my first time) and since I was hoping for someone to actually give me the required formula to convert to Easting and Northing (i hope that doesnt sound lazy), I was reserving a A for this only. I also appreciate your on-going interest. You are real asset to experts-exchange!
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
Well, usually there are more A's than B's !
I thought I gave the formula :(
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
Funny I'm back to this thread searching for a data from my own answer :) Since I'm here, let me add that:

Considering the time to make this answer and its rareness (you can search google - and you probably did it :) it deserved an A.
You talk about a << real asset to experts-exchange >> but you don't contribute to encourage people keeping answering.

This is what I think :)
0
 
LVL 1

Author Comment

by:Dr_Snapid
Comment Utility
I think that is a fair comment Merc, you are right. I couldnt find the answer on Google, and this is not something I considered when grading your score.

Your answer came up with this result:
Mercantilum>>>"So you get your (lat,long) = (31S, 80W)  => UTM (Northern -6555, Eastern 611km zone 17)"

When the answer i needed was:
Mercantilum>>>"So you get your (lat,long) = (31S, 80W)  = -XXXXX mtrs Northing, -XXXXX mtrs Easting"

I can see how much effort you went to. It was an A grade effort, and had I kept the thread running longer I am sure you would have landed me on the correct calculation. Please understand that we never actually got to the correct answer, we only got part of the way there, I did the rest myself. This is why I originally went for a B. I got there in the end only because of your help though - so I agree I 'could' have given you an A, but I am not totally convinced I should have. Personally, your grade is not that important to me that I would stand back and insist it's a 'B' - it obviously is important to you - so I'd give you an 'A' no worries. I am dissapointed by this statement:

Mercantilum>>>"but you don't contribute to encourage people keeping answering"

Even though I'd like to, I cant change your grade, as far as I know. I'm sorry mate. I really do think you are an asset to experts exchange, and I hope you continue to be. I wouldnt take the time to write this post unless I sincerely meant it.
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
Well, maybe a Page Editor can  change to A :)
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
This is exactly what I think:
- yes I care about points but may times my answer was not accepted as the author chose the first or last one ... and I don't really care
- the think is sometimes I really want as a personnal challenge to provide an accurate answer - it was the case for this one

And when other people will look for a similar question - they will see a B and think, well it's not what i'm looking for :)
0
 
LVL 1

Author Comment

by:Dr_Snapid
Comment Utility
If a page editor can change it to an A, I invite them to. You deserve an A. Cheers.
0
 
LVL 1

Author Comment

by:Dr_Snapid
Comment Utility

Mercantilum >>>"- the think is sometimes I really want as a personnal challenge to provide an accurate answer - it was the case for this one"

I like your attitude. Do you need a Job? I'd give you one...
0
 
LVL 10

Expert Comment

by:Mercantilum
Comment Utility
You can send a job description to my email http://www.experts-exchange.com/M_2239020.html :)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

We are taking giant steps in technological advances in the field of wireless telephony. At just 10 years since the advent of smartphones, it is crucial to examine the benefits and disadvantages that have been report to us.
Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now