Hi, I have a square plane, and I assign the center of the plane, an
arbitrary lat/long, and I also do the same for the upper right corner,
and the lower left corner..... Let's say I have an object, like a
car, that will travel on this plane on a predefined path, at a
constant velocity, and I know the start time, and end time, is there
any way I can get the Latitude and Longitude of the object at
everypoint along the plane using Linear Interpolation(or some other
mathematical way). I hope I explained my question well....Any help
would be greatly apperciated....Thanks
Ex.
=========  (83 Lat/ 40 Long)
 
 
 * 
(84 Lat/39 Ln)
 
=========  
Clarification of Question by
arunkkga
on
06 May 2004 18:20 PDT
=========  (83 Lat/ 40 Long)
 
 
 * 
(84 Lat/39 Ln)
 
========= 
(85 Lat/38 Long)

Request for Question Clarification by
mathtalkga
on
07 May 2004 19:22 PDT
Hi, arunkkga:
It seems to me that your Question presupposes a number of assumptions
that might not be supportable.
If we assume the "square plane" you refer to contains points that are
assigned a product of latitude and longitude ranges, then over
relatively small such ranges it may be practical to compute distances
from "linear" functions of the differences in coordinates. (Your
Question concerns velocity, but this is a ratio of distance to time,
and the time calculation poses no difficulty.)
However I cannot see how to make sense of assigning coordinates both
to the center of the "square" and to two corners. In a graphical
application one would normally assign coordinates only to opposing
corners, with the convention that points on the top and bottom edges
have a constant coordinate in one axis and the left and right edges
constant in the other axis.
Also in your example you use a latitude range of 83 to 85. If this
were degrees of latitude, it would be close enough to the South Pole
to produce some difficult with the "linear" interpolation of distance
from Lat/Long coordinates.
If you do a search on latitude and longitude coordinates here at
Google Answers home page, you will find some previous Answers that
provide more accurate and applicable formulas for computing distance
over the Earth's surface (I know; I wrote some of them!).
If you prefer, I'd be happy to study your Clarification to the issues
raised above and give a brief Answer, commensurate with the list price
offered, along the lines of "linear interpolation". These formulas
would be reasonably accurate as long as the "square" patches are not
extended and are not near either pole.
regards, mathtalkga

Clarification of Question by
arunkkga
on
07 May 2004 19:45 PDT
Hi Mathtalk, to clarify your questions......I had my lat/long wrong,
it was supposed to be 39Lat/84Long(Dayton, OH, not south pole :) )
First I want to say that I dont' know much about lat/long, so what I
may say may not make sense, but i'll try to be clear....
Now, you said, it dosen't make sense to assign a lat/long to the
center of the terrain, and also the upper right and lower left....I
don't understand why....if we use my example lat/long as above, center
lat/long can be dayton, and the upper right maybe some where near
cleveland, and lower left can be around evansville, indiana.....
These three points would be within our "square", I hope this made some
sense....
Also, let's assume that we don't talk about velocity, how would you
calculate your exact location somewhere within this "square" from our
lat/long of center,uppper right, and lower left locations?
Thanks

Request for Question Clarification by
mathtalkga
on
07 May 2004 19:56 PDT
Hi, arunkkga:
Here's what I'm getting at about the three coordinates.
Pick two points on the globe. Make one the upper right corner and the
other the lower left. Hopefully this makes good geographical sense so
far.
Now the center of the square is the center of the square. It's not a
free variable that you can arbitrarily assign. Once you choose the
corner points, assuming by "square" as I said before that you mean the
product of a range of latitudes and a range of longitudes, then the
center of the square ought to be the midpoint of both the latitude
range and the longitude range.
Of course you can pick three distinct points anyplace inside a square,
if that's what you are getting at. But you seem to lable the points
as corners and as the center of the square, and that's where I think
we need to be careful.
Unless you are simply interested in the (spherical) distance formula
between two points given by latitude and longitude, it might be
expeditious to back up and explain where the data you propose to
define the "square" is coming from. I might get a better idea of what
role the three points you want to use mean from the application you
intend to use them for.
regards, mathtalkga

Clarification of Question by
arunkkga
on
07 May 2004 20:58 PDT
hi mathtalk
Ok, let me try go clarify again my question, i'm sorry i'm not being
concise enough.....maybe the term "square" is throwing us off....
Let me give some background on why I need help with this..lat/long
stuff. We are working on a trainingsimulator at work in which an
aircraft(s) will fly through a simulated terrain. To stick with my
previous example, let's say that this terrain is the entire state of
ohio, and now to the lat/long points..... Now let's select 2 points
on this terrain, the upper right corner of Ohio(some where near
Cleveland lat/long), and the lower left corner (somewhere near
Cincinatti lat/long). Now I pick a 3rd point to resemble a point
somewhere halfway inbetween these two, and let's say we pick Columbus
OH, which happens to be in the middle of our other two points..so now
we have these three points located inside a "imaginary" squarebox, i
hope you know what I mean.....
Now we have three points......using the lat/long of ONLY these three
points, is it possible anyway to figure out(I assume mathematically)
where exactly in terms of latitude/longitude where an object(our case
an aircraft) is located within our entire "terrain(ohio)"... In
reality if you know the upperright/lowerleft cordinates, you can get
the upperleft/lowerright cordinates from the others....correct?
You are right, I am not looking for a distance between any given
lat/long points, I need an answer in terms of lat/long, and I believe
in our system, I can get the distance of where an object is located in
meters from the center lat/long point, if that may make things any
easier to solve this issue....
Maybe i'm asking for something that is not possible, but if you could
give it a shot, I would apperciate it!

Request for Question Clarification by
mathtalkga
on
08 May 2004 08:41 PDT
Maybe it would help if you state explicitly what is "known"
information and what is to be computed.
It sounds partly as if you "know" the location of three points, one of
which "happens" to be in the middle of the other two. For the sake of
argument let's assume this does not mean an exact center point, just
that it falls somewhere in the "box" of latitude/longitude values
"bracketed" by the two corners.
Now you introduce a fourth point, the location of the aircraft.
Missing entirely from our discussion is any information that relates
the aircraft to the three (presumably fixed) locations. Are you
asking how to determine the location of the aircraft by
"triangulation"? I.e. given the aircraft's distance to each of the
three points, use that to determine the position of the aircraft?
Such a calculation is possible, though of course with an aircraft you
have a third dimension (altitude) to account for (besides latitude and
longitude). I hesitate to leap to any conclusion about whether this
is what you are trying to do, esp. as in your original Question the
implication was that a vehicle was travelling along a "predefined
path, at a constant velocity" with defined beginning and ending
points.
regards, mathtalkga

Clarification of Question by
arunkkga
on
08 May 2004 10:47 PDT
Hi,
The known data are as follows:
1. Upper Right corner latitude/longitude
2. Lower Left corner latitude/longitude
3. Center point latitude/longitude
4. Altitude of aircraft anywhere on the terrain
5. Speed of aircraft in meters/second
6. Distance of aircraft from center point of terrain
The latitude/longitude of all points listed above are fixed(set in a
configuration file).....Yes I do want to know the location of the
aircraft in terms of Lat/Long at any place in our "box"(terrain)(with
minutes/seconds in there for precision) given the known data listed
above..am I asking for too much :) ??
I didn't understand why altitude of the aircraft would come into play,
no matter what altitude the aircraft is located, that dosen't affect
the location in terms of lat/long does it?
Now regarding velocity, I'm not sure if it makes any difference
knowing this for our problem, but yes, our aircraft will fly a
constant or a variable velocity on a track which is on the terrain,
and we know the the begin time and end time of the track which the
aircraft will fly on....
So, I guess what I am looking for is to find teh location of the
aircraft using "triangualtion" or someother method, using any/all the
data listed above....
Thanks,
A

Request for Question Clarification by
mathtalkga
on
08 May 2004 13:34 PDT
Sorry, I'm still confused, but I can see we are making progress.
Ignoring the distance changes caused by altitude (since you include
the altitude among the "known" data now), all I can see that we can
deduce from knowing the distance of the aircraft from the center point
is that the plane is on a circle of radius equal to that distance. It
could be anywhere on the circle unless some additional information
were available.
If you look back at your original Question, it seemed that you were
speaking (about a car) of knowing where the vehicle was at a starting
point in time and again at some ending point. You also refer to a
constant velocity (and predefined path) which seems to relate to the
"constant or a variable velocity on a track" mentioned in your last
Clarification.
Let me ask this. Is the aircraft's position known at the "starting
point in time"? It seems to me that what you would want to do for an
aircraft simulation is to "integrate" its velocity from a known
starting point to obtain the aircraft's position at future points in
time.
Perhaps what you are coming up against is a difficulty in converting
from distance in meters to (change in) degrees of latitude/longitude.
Degrees of latitude are a nearly constant length (in meters or
kilometers) whereas the "length" of a degree of longitude varies from
a maximum at the equator down to zero at the poles. In other words
the length of a degree of longitude depends on latitude (but not
conversely).
regards, mathtalkga

Clarification of Question by
arunkkga
on
08 May 2004 16:31 PDT
The aircraft can fly a constant velocity on the track, or it can
change velocity on the track....(a track is created by the user who
literraly uses the mouse to click on the terrain to plot points, and
we just draw a line through those points to create the track; the user
can leave the velocity at a constant, or change the velocity before
plotting another point on the terrain, thus the aircraft can change
velocity between points, when I mean points in this context, I don't
mean lat/long...I mean an X,Y,Z in world space)
Yes, I know the starting point(XYZ) of the aircraft on the track, and
ending point of the aircraft on the track(XYZ).....
I hope I didn't confuse you even more!
Regards,
A

Request for Question Clarification by
mathtalkga
on
09 May 2004 07:40 PDT
If you knew the XYZ "worldspace" coordinates for the aircraft
throughout its flight, would it be sufficient to have a function that
provides latitude and longitude from the XYZ coordinates?
The picture that's emerging from our discussion is that XYZ
coordinates are translatable to meters, and that the "center" of the
square or box under discussion corresponds to the origin in the
worldspace coordinates (or can be translated to the origin at least).
regards, mathtalkga

Clarification of Question by
arunkkga
on
09 May 2004 08:57 PDT
If it is possible to get the lat/long of the aircraft from the XYZ
Coordinates of the aircraft anywhere on the terrain, that would be
great....Yes, the Center Lat/Long in our "box", has the XYZ cordinate
of 0,0,0.
(Y = North, X = East, and Z = Altitude)
Thanks again!

Request for Question Clarification by
mathtalkga
on
10 May 2004 08:48 PDT
Hi, arunkkga:
Great, I think the Question is now in a form that I know how to Answer!
Since you've raised the issue of accuracy, it would help if you could
set some limits on where the functions will be applied. For example,
the notion of excluding the north and south polar regions has already
been mentioned.
Will the flight paths be limited to the continental US?
Apart from where the flights originate, are there limitations on how
far from the "origin" a flight can go? For example, will there be a
need to model regions that range up to (say) 300 miles from the
origin?
regards, mathtalkga

Clarification of Question by
arunkkga
on
10 May 2004 15:59 PDT
Hi mathtalkga,
Answers:
>>Will the flight paths be limited to the continental US?
No, our system is being delivered to our customer in Australia, and
our terrain model that we are working on is actually a model of the
Aust. Outback.... Here I am just using an example
lat/long(Dayton,OH), but since the lat/long(s) will be user
configurable, I am assuming that our customers will change it to a
location closer to home, when they get the system...
>>are there limitations on how far from the "origin" a flight can go?
Our terrain model has a radius of 50Km from the center of the terrain,
and the users will be trained to plot the aircraft tracks within
range(Technically they could plot points farther than 50km, but they
will have no reference to the terrain, since our model will not extend
farther than this, but this should not be an issue)....
Thanks
arunkk

Request for Question Clarification by
mathtalkga
on
11 May 2004 18:18 PDT
Hi, arunkkga:
Since there's programming involved here, it might be helpful to give
me an idea what sort of programming language is involved. Of course
I'll give the mathematical formulation, but I might be able to throw
in some insights about implementation techniques.
regards, mathtalkga

Clarification of Question by
arunkkga
on
11 May 2004 18:34 PDT
Hi mathtalk
I am using a Graphis program called Maya by AliasWavefront, and I use
MEL(Maya Embedded Language), it's a scripting language very similar to
c++....If you want you can check the link below, and check out some of
the math functions that are available that I can use, if it can help
you in any way to better achieve the results...
http://caad.arch.ethz.ch/info/maya/manual/Commands/functionalCmdList.html#Language:Math
Thanks,
arunkk

Clarification of Question by
arunkkga
on
18 May 2004 15:27 PDT
Hi Mathtalk,
Just checking in to see if you need any more clarifications??
I hope you have not given up on me :)
Regards,
arunkk

Request for Question Clarification by
mathtalkga
on
18 May 2004 16:31 PDT
No, but I'm working out how accurate the simplest possible useful formulas are.
Generally speaking I think the error will be dominated by positioning
of the "origin" in terms of longitude/latitude. A good GPS reading is
rarely able to get within 25 meters of true position, and most maps
are subject to fairly systematic errors in local coordinates.
So my aim is to show that the approach I'll propose is at least
comparable in accuracy to that.
regards, mathtalkga

Clarification of Question by
arunkkga
on
18 May 2004 16:42 PDT
Ok, thanks mathtalk....I'll wait for your answer
regards arunkk

Clarification of Question by
arunkkga
on
19 May 2004 12:29 PDT
mathtalk,
I wanted to find out if we could maybe do things simpler
that what we talked about before.....We talked about having 3 sets of
lat/long, upper right, lower left, and center. Would it be simple if
all we had was the center lat/long, and if I knew the aircraft was for
ex. say 1100 meters west, and 700 meters north of my center lat/long,
would I be able to figure out what my new lat/long is?
Regds,
arunkk

Request for Question Clarification by
mathtalkga
on
19 May 2004 13:03 PDT
Yes, that's precisely the right idea.
The simplest conversion is to translate the X coordinate into a
difference in longitude and the Y coordinate into a difference in
latitude. If this doesn't prove "accurate" enough for your purpose,
then we can consider fancier methods.
The key is to determine how long a degree of latitude and how long a
degree of longitude is, e.g. in meters. These lengths should be
approximately constant over the region of the flight, but can vary
from on part of the globe to another.
On a perfect sphere degrees of latitude (North or South) will always
have the same length. This is not quite true on the Earth's globe,
where degrees of latitude at closer to the poles are actually slightly
longer than at the equator. This seems paradoxical to me, but several
sources I've checked are consistent in giving values for this.
Degrees of longitude (East or West) will naturally vary with latitude,
being at maximum length around the equator and then shrinking to zero
as you approach the poles.
Now in your case the region in play is rather small, 100 km in
diameter, so the first idea to check is what happens if we compute the
length of a degree of latitude and a degree of longitude right at the
center of the region (the origin), and then use those values
throughout the flight to convert X,Y to offsets in longitude and
latitude (from the origin).
Also I have some code that will compute the length of a degree of
longitude and of a degree of latitude at any latitude. You'll
probably want to incorporate this code into your program, although for
a fixed location it would be just as easy to incorporate the resulting
constants into your "terrain" data set.
I'll go ahead and post the formulas so you can take a look while I
thrash out the "accuracy" of the approximation. On one hand I do not
believe that accuracy in conversion is really a "stopper" for your
application, because internally your program will maintain the flight
location in X,Y,Z coordinates. It will not rely on converting back
and forth from longitude & latitude to Cartesian coordinates, for
example. So the new calculations will not introduce error into the
existing positioning code.
However the mapping is only an approximation to reality, so I want to
give you at some point a feeling for how the Cartesian space diverges
from the curved coordinate system of longitude and latitude. For
example, while changing Y if X = 0 is a true North/South motion, for
nonzero values of X this is only approximately so.
regards, mathtalkga

Clarification of Question by
arunkkga
on
19 May 2004 15:28 PDT
hi mathtalk,
responses to your comment:
>>The simplest conversion is to translate the X coordinate into a
>>difference in longitude and the Y coordinate into a difference in
>>latitude. If this doesn't prove "accurate" enough for your purpose,
>>then we can consider fancier methods.
>This should be accurate enough for me for now
So, if I follow you correctly, as long as I can provide teh center
lat/long, the distance in meter of the aircraft from teh center
lat/long, and the bearing of the aircraft, we don't need the upper
right & lower left lat/long, correct?

Request for Question Clarification by
mathtalkga
on
19 May 2004 16:55 PDT
Hi, arunkkga:
That's correct, although if you have the lat/long coordinates for
those points as well as the X,Y coordinates, you can use them to get a
(slightly cheesy) approximation to the meters per degree values we
need.
Just use the difference in the corners X coordinates (which I'm
assuming is in units of meters) divided by the difference in
longitudes and that gives the meters per degree of longitude.
Similarly use the difference in the corners Y coordinates (again in
meters) divided by the difference in latitudes and that gives the
meters per degree of latitude.
Of course I think you'll find the computational approach more
satisfactory, if only because it makes the set up more "portable".
You (or your Customers) will not need the corner points, just the
central location's latitude and longitude (which would be needed in
any case to denote the origin).
regards, mathtalkga

Clarification of Question by
arunkkga
on
19 May 2004 18:08 PDT
hi mathtalk,
I came across this formula, given a heading and a distance of an
object from a point(lat/long), it claims that it returns the lat/long
of the object....

Lat/lon given radial and distance
A point {lat,lon} is a distance d out on the tc radial from point 1 if:
lat=asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
IF (cos(lat)=0)
lon=lon1 // endpoint a pole
ELSE
lon=mod(lon1asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)pi
ENDIF
This algorithm is limited to distances such that dlon <pi/2, i.e those
that extend around less than one quarter of the circumference of the
earth in longitude. A completely general, but more complicated
algorithm is necessary if greater distances are allowed:
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( lon1dlon +pi,2*pi )pi

In teh top formula for the lat, I plugged in 39(deg) for lat1,
distance = 1400meters, and a radial of 80 degrees, and I ended up with
an lat of .433 ?? This didnt' make any sense to me, is this correct?
lat = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc));
.433 = asin(sin(39) * cos(1400) + cos(39) * sin(1400) * cos(80));

Request for Question Clarification by
mathtalkga
on
19 May 2004 18:55 PDT
Before we go too far down the path of analyzing that formula, let's
settle the question of whether you are already maintaining the
location of the plane in X,Y,Z coordinates.
If you are, it would not make sense to try and track in parallel the
movement of the plane in longitude and latitude coordinates using
"distance and heading" information there, when the same information is
already available by conversion of the X,Y,Z coordinates.
regards, mathtalkga

Clarification of Question by
arunkkga
on
19 May 2004 19:32 PDT
Yes, I will always be able to get the xyz location of the aircraft,
that functionality will always remain there....

Request for Question Clarification by
mathtalkga
on
20 May 2004 06:58 PDT
Okay, the formula you found apparently is intended to work on a "unit"
sphere and with angles measured in radians.
Only with such a context would it make sense to take the cosine of distance d.
Thinking of distance d as being measured "over the surface" of a unit
sphere, the length along a "great circle" for that sphere would equal
(in radians) the central angle subtended by that arc (the angle as
seen from the center of the sphere between the two endpoints of the
arc).
Headings on the surface of a sphere are a bit tricky. Where in the
flat plane the angles of a triangle always add up to 180 degrees (pi
radians), in spherical triangles the sum of angles is always greater
than pi. In fact the amount by which the sum of angles in a spherical
triangle exceeds pi is directly proprotional to its area.
Tiny spherical triangles are therefore "closest" to being flat!
regards, mathtalkga

Request for Question Clarification by
mathtalkga
on
20 May 2004 18:52 PDT
Hi, arunkkga:
See the material posted as a Comment at bottom on how to determine the
lengths in meters of a degree of latitude or of longitude anywhere on
the Earth's surface. As previously noted, these lengths are functions
of latitude.
Grouping the length formulas there will allow me to formulate an
Answer that focuses on the somewhat tricky points of relating the
(artificial) Cartesian coordinates in which your flight simulation
"lives" to the curved coordinates of latitude and longitude.
regards, mathtalkga
