MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Points in a straight line

This is a discussion on Points in a straight line within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have a number of lines drawn on a map and for the purposes of a program I am writting ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-24-2004
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Points in a straight line

I have a number of lines drawn on a map and for the purposes of a program I am writting I need to get about 10 coordinates along the length of each line, I can get the coordinates at the end of each line but, not being particularly great at maths!!!, I cant work out how to get coordinates along the length of the line.

Does anyone know what the equation might be to do this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 05-24-2004
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
Is this a straight line? If so:

You can derive it from the principle of like triangles. Or from vector addition.

Let your endpoints be A and B
A = (x1,y1)
B = (x2, y2)

Let Delta = A - B
ie. Delta_X = x1-x2 and Delta_Y = y1-y2

Point P on line = (xp,yp)

xp = x1 + L * Delta_X
yp = y1 + L * Delta_Y

L = Real number in the range 0...1
0 gives A, 1 gives B
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 05-24-2004
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Thanks for your help, what i'm trying to do is plot positions within a freeform shape by using horizontal scan lines from left to right and as we move across the scan lines I need to be able to know if I have crossed a line in the shape, if i cross an odd number of lines I must be inside the shape, an even number and i'm outside.

Therefore I need to be able to work out if the x position on a particular y scan line has crossed a line in the shape so I think what I need to know is the x position on the shape for a given value of y.

I already know the coordinates for all the points on the shape.

I think this makes sense but as I said I never was any good at maths! Do you think you could help by giving me an 'idiots guide' on how I should go about doing this. Possibly using an example

Lat, Lon

Start point of line 50.83386, -0.1674
End Point 50.8335, -0.1688

So now I want to find the x(longitude) position on the line where y(latitude) = 50.8337
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 05-24-2004
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
I think there was an error in my original reply - the sign of Delta is reversed.


For what you're after a "Method of Similar Triangles" is probably more appropriate but requires a diagram to be clear. Mathematically it is the same though.

Line A-B, what is X for a particular Y?
A=Ax,Ay
B=Bx,By

Like triangles gives:
(Ax-Bx) / (Ay-By) = ( X - Bx) / ( Y - By)

Note: Ay=By will give an error - you need to check for this.
As will Y = By

Re-arranging,

(X-Bx) = (Ax-Bx) * (Y-By) / (Ay-By)

=> X = Bx + (Ax-Bx) * (Y-By) / (Ay-By)


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 05-25-2004
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Thanks for your help, i'll give this a try and i'll keep you posted
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 05-25-2004
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Thanks for your help again, you will be pleased to here that using that equation I have now managed to write the code for working out points (addresses) within a freeform shape, this has saved me and others hours of extra work.

Thanks again for you help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 05-25-2004
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
Glad to be of help!

Really it is just a form of linear interpolation - I've it used on everything from geometric problems to interpolating seismic velocities near salt in sedimentary basins such as the Gulf of Mexico and the North Sea!


btw, If you have any further problems, I'm available for hire...


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
line, points, straight


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
how to draw a line between points bobil MapPoint 2006/2009 Discussion 2 05-25-2006 09:23 AM
draw simple line between points Anonymous MapPoint 2006/2009 Discussion 0 07-27-2004 05:15 AM
Railways - why can't they be straight! Mossoft MapPoint 2006/2009 Discussion 1 04-14-2004 08:05 AM
How can I create a line between two line with VB6 Anonymous MapPoint 2006/2009 Discussion 0 04-29-2003 06:44 PM
As I draw a line and then a pushpin on that line, .... Anonymous MapPoint 2006/2009 Discussion 1 07-16-2002 09:35 AM


All times are GMT -5. The time now is 02:43 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54