Link to home
Start Free TrialLog in
Avatar of Dave March
Dave March

asked on

How do I plot a specific position along a line between two coordinates in VB


I have a straight line drawn between two sets of Lat/Lon coordinates. Let's say they are 100 miles apart, and  I want to plot additional positions along that line, say one at 20 miles, one at 30 and another at 65 miles, and provide the Lat/Lon for those positions, would anyone know of a routine to achieve this? Preferable in VB6 but VB.Net would suffice.
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Do you have absolute coordinates (x, y) that you are using for the two endpoints?  Is it being drawn on a 2D map?  Can you show your code now that draws the line?
Avatar of Dave March
Dave March



Thanks for replying. No they're not absolute coords, just the lat/lon of locations A and B, specifying start and end of journey. I'm not actually drawing anything, I can easily determine the distance between the two but don't know how to grab the lat/lon of, for instance, the halfway mark. Because the marked point still needs to be 'in line', so as to move from A to B, via this halfway mark without changing course.... if that makes sense?
Okay, so you're using some kind of mapping software that draws the lines for you?
Again I'm not actually drawing any lines and don't need to. This is for simulated navigation, so we maybe going from A to Z via B, C and D, going in a straight line between each point. By that I mean from A to B would be straight and then we may have to turn 90 degrees to get to C (again in a straight line). So if I wanted to insert an additional point between any two of the existing one it would be in line and a course deviation between the two existing points would not be necessary.
I guess the answer's no then?
Sorry, never worked with lat / long before.
No problem. Thanks for letting me know.
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
After playing around on I can't really tell by eye if a mathematical mid-point (like I posted) differs much from the spherical WGS-84 calculation they do there. Supposedly the difference can get quite big the more the latitudes differ (longitudes not so much/not at all?) and the further away the points are from each other which is logical I guess because the coordinates are just not 1 to 1 scale over the surface of the earth.
Heck, that was simple !!!!

Thank you soooooooooooooo much for that..... really appreciated