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

HI,

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.
Dave MarchAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
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?
Dave MarchAuthor Commented:
Hi,

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?
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Okay, so you're using some kind of mapping software that draws the lines for you?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Dave MarchAuthor Commented:
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.
Dave MarchAuthor Commented:
I guess the answer's no then?
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Sorry, never worked with lat / long before.
Dave MarchAuthor Commented:
No problem. Thanks for letting me know.
Robert SchuttSoftware EngineerCommented:
Sorry if I misunderstand the requirement but maybe simply something like this for a half-way point (pseudo code):
AB1.lat = (A.lat  + B.lat) / 2
AB1.lng = (A.lng  + B.lng) / 2

Open in new window


As long as you're (virtually) drawing straight lines that should put AB1 in the middle of A and B right?

More generic then, for part miles of total miles between points A and B:
AB2.lat = A.lat  + (B.lat - A.lat) * part / total
AB2.lng = A.lng  + (B.lng - A.lng) * part / total

Open in new window


Of course that is all just dribble if you need to cater for real geo data, WGS-84 for example? You need serious calculations in that case...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert SchuttSoftware EngineerCommented:
After playing around on http://www.geomidpoint.com/ 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.
Dave MarchAuthor Commented:
Heck, that was simple !!!!

Thank you soooooooooooooo much for that..... really appreciated
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.