I have two sets of "lines" drawn using a mapping API in the form of (lat,long) pairs. Given 2 of these lines, how can I compute the (lat, long) of their intersection (assuming they intersect)?
A:
Depends on what coordinate system you're in.
You'll need the geodesic along the surface of the model you're using for each line segment (you can choose any convenient altitude you want since you only care about lat and long). Then the point that's on both geodesics (if it exists) is your answer. Note also that one geodesic may be coincident with the other (superimposed).
Since you're using the Mercator projection, you can translate the lat and long to X and Y on your map, then solve for their intersection easily.
John at CashCommons
2010-09-24 20:50:07
I am using the mercator projection so my lines are straight lines not geodesics..should have mentioned that.
ikp
2010-09-24 20:59:52
Your geodesics *are* straight lines. ;)
John at CashCommons
2010-09-24 21:13:32