alan2here Posted November 17, 2010 Posted November 17, 2010 For moving about on a sphere in a "straight" line in a given direction. final_latitude = latitude + (sin(angle) * distance) final_longitude = longitude + (cos(angle) * distance) Except it only works well in the tropics, neer the equator. The closer to the poles you go the more inaccurate it becomes tending to be attracted towards them, does anyone know how to correct it?
Shadow Posted November 17, 2010 Posted November 17, 2010 I don't know if it contains the answer to your question, but you ought to take a look at this.
alan2here Posted November 17, 2010 Author Posted November 17, 2010 (edited) Thanks. Based on the information in the article. The accuracy of distance calculations using the planar approximation become increasingly inaccurate as the separation between the points becomes greater or a point becomes closer to a geographic pole. Seems to sumerise my problem nicely. I don't entirly understand the equations in the article but I think it's saying: A. distances on an X\Y plane = sqrt(x^2 + y^2) B. distances on a lat\long sphere = sqrt(latitude^2 + (cos(?) * longitude^2)) Also: moving on an X\Y plane: C. x' = x + sin(a) y' = y + cos(a) moving on a lat\long sphere: D. latitude' = ? longitude' = ? C is to A as D is to B. I'm not sure that it's possible to determine D from just this information though. Edited November 17, 2010 by alan2here
imatfaal Posted November 17, 2010 Posted November 17, 2010 Alan this looks a useful set of ideas http://mathforum.org/library/drmath/sets/select/dm_lat_long.html one of which might help
Shadow Posted November 17, 2010 Posted November 17, 2010 [math]\phi_m[/math] is the mean latitude, which is defined in the section "Nomenclature of the article I link to. As for the "moving on an X/Y plane", I don't understand what you're saying. On a plane, [math]x' = x + \Delta x[/math] and [math]y' = y + \Delta y[/math]. If anything, it should be [math]x' = x + cos(a)[/math] and [math]y' = y + sin(a)[/math], since (one of) the definitions of those trigonometric functions has to do with the respective coordinated involved. But even then, I have no idea what sin(a) or cos(a) has to do with movement on a " X/Y plane", unless you're using polar coordinates for some reason (and even then it would be incorrect).
TonyMcC Posted November 17, 2010 Posted November 17, 2010 I guess your "straight line" on the surface of a globe is the shortest distance between two points travelling along the surface of the globe. (i.e. actually a curved path). If I am correct then you are looking to calculate the part of a Great Circle that joins the two points. If you google "great circle" you will get lots of information.
alan2here Posted November 17, 2010 Author Posted November 17, 2010 (edited) Fantastic :¬) Have I understood this correctly? http://mathforum.org/library/drmath/view/51816.html d is the distance to travel tc is the angle at which to face at the start lat1 is the latitude at the start lon1 is the longitude at the start lat = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)) dlon = atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat)) lon = mod(lon1-dlon +pi,2*pi)-pi Shadow. To move on a plane. x' = x + sin(a) y' = y + cos(a) As in 'x' after youv'e moved = x + sin(a) and y' = y + cos(a) where 'a' is a number representing the angle your moving at, so the next 'x' is one unit in 'a' direction from the previous. However this dosn't work between latitudes and longitudes on a sphere except neer the equator. Also TobyMaC i'm specifically trying to avoid using that method for now. Id rather use the equation above if possible to continue to deal in latitude and longitude instead of trying to calculate the normal of a vector, measure an intersecting sphere and a plane amoung various other things I would have to do to implement it that way. It would involve rewriting a lot of existing stuff as well, putting it into a form that would require me to make a trip back here if I ever needed to change anything. Edited November 17, 2010 by alan2here
TonyMcC Posted November 17, 2010 Posted November 17, 2010 I'm not a mathmetician so I have only glanced at your formulae but I don't see any reference to the size of the globe. For example if the globe is very large and the distance involved is small then the surface will be almost flat and so you would get a good approximation using a right angled triangle with straight sides. If the globe is small and the distance relatively large then your "triangle" would have strongly curved sides. I can't help feeling that the size of the globe is an important factor - sorry if I am wrong about that. 1
imatfaal Posted November 18, 2010 Posted November 18, 2010 Alan - I dont have time right now to go through but I am not sure you do have the rught idea. Tony is of course correct - there has to be some reference to the size of the world. At a quick glance I think d is a distance measured as a ratio of distance travelled over radius of earth. this for small angles will give the radian angle at centre of earth. you will note that your equation has sin and cos d - this only really makes sense if they are angles. Will have a look later - or maybe you can work through an example and see if the sums tally.
alan2here Posted November 18, 2010 Author Posted November 18, 2010 (edited) TonyMcC an excellent observation, thanks. However the distances are relative to revolutions, so we go for example "quarter way round the sphere north east" not "10 miles round the sphere north east", therefore it dosn't matter how big the sphere is for this part of the calculation, going a quarter of the way round a small sphere from an existing latitude and longitude will produce the same final latitude and longitude as going quarter of the way round a large sphere in the same direction. The equation came from the link and I can't understand why it works, but it does seem to take the correct inputs and the text in the link describes it's process as producing the answer I need. Do you have doubts that it works imatfaal? I'd love to go though them now before trying to implement this equation. Edited November 18, 2010 by alan2here
imatfaal Posted November 18, 2010 Posted November 18, 2010 Alan - what's your question? and have you plugged in the figures and got a reasonable answer? Pick two points on google earth - use measure tool to get rough distance and angle and check the equations. if you cant get that to work - you don't understand the equations or they are wrong
alan2here Posted November 18, 2010 Author Posted November 18, 2010 (edited) Iv'e just tried it in Excell. It dosn't work, for example moving a distance of 0 causes you to end in a very different place than you started. My question is either whats up with Doctor Rick's equation or more likely how I have written it wrongly? This Excell file shows a position and the intention to move north east, the simple method of moving it that only works neer the equator and ricks method. It plots thease onto a graph. http://with-logic.co.uk/a/moving.xlsx Edited November 18, 2010 by alan2here
imatfaal Posted November 19, 2010 Posted November 19, 2010 From looking at the equations - i would guess that d has to be an angular distance; that is it say it is the angle in radians made by the two end points of the journey and the centre of the earth. So if you divide your journey distance by radius of earth - you will get d; which by definition is also an angle in radians. I am loath to look in detail at the equations and work out if they are correct, cos it spoils the fun; but I think from quick look d has to be journey/radius I thought about this on the train home - if I had to do it from scratch I am pretty sure that I could rearrange the cosine rule of spheres to get a formulation that would work. perhaps try looking at that rule on wiki or mathworld and see how you do
alan2here Posted November 19, 2010 Author Posted November 19, 2010 (edited) Thanks. I don't need to do the "divide your journey distance by radius of earth" part as I want to input distance as an angle difference between the start and end points, not as a distance, so it's quite convenient. Thanks for the verification that this distance (angle difference) is measured in radians, so presumably pi*0.5 = quarter of the way round the sphere. http://en.wikipedia.org/wiki/Spherical_law_of_cosines There dosn't seem to be any one equation with all the parts I need that I can get Wolfram Alpha (I'm not being lazy I'm just not verry good) to rearrange. If this isn't relevent as Rick's equation works and I'm just using it wrongly or you can't do it like this and so this is a dead end anyway then I don't want to spend too much time on it, however if it is usefull does this look right? Set 'u' lat and long to be on the starting point Set 'w' lat and long to be on the north pole Set 'C' as the angle facing Set 'a' as the distance to travel. Find 'v' lat and long. Edited November 19, 2010 by alan2here
TonyMcC Posted November 19, 2010 Posted November 19, 2010 (edited) Can I make an observation? If you are making a calculation based on angle moved using the centre of the globe as the point of rotation and converting that angle into distance around the globe you are actually finding the distance between two points lying on a great circle. I am not really into mathematics but if I had to work this out I would go along that path (no pun intended!). If I can make another observation which I feel must complicate the calculation it is :- Lines of longitude are great circles, lines of latitude are not. Edited November 19, 2010 by TonyMcC
alan2here Posted November 20, 2010 Author Posted November 20, 2010 (edited) Given the 4 inputs I have can the 2 outputs I require be determined using the great circle method? p.s. Please could somone look at the spreadsheet I posted. Edited November 22, 2010 by alan2here
alan2here Posted November 24, 2010 Author Posted November 24, 2010 (edited) I have now solved this problem with help from http://mathforum.org/dr.math/ Edited December 1, 2010 by alan2here
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now