Select to view content in your preferred language

Determining the direction and sides of line

1810
4
05-26-2011 05:12 AM
JollyJacob
Emerging Contributor
Hi,

Is there a formula that can be used to determine the direction of a polyline if the user defines the start and end point. We don't want to use the direction of the polyline feature. After determining the direction, points have to be added along the left-side and right-side of the line in the direction that has been computed. So the sides have to be determined based on the direction. Tried a lot of searching but to no avail. Any help will be greatly appreciated. Application is in Silverlight on ArGIS 10.

Thanks
Jolly
0 Kudos
4 Replies
IgressT
Emerging Contributor
Hi,

Is there a formula that can be used to determine the direction of a polyline if the user defines the start and end point. We don't want to use the direction of the polyline feature. After determining the direction, points have to be added along the left-side and right-side of the line in the direction that has been computed. So the sides have to be determined based on the direction. Tried a lot of searching but to no avail. Any help will be greatly appreciated. Application is in Silverlight on ArGIS 10.

Thanks
Jolly


I know how to do that in ArcObjects using the ILine interface which has Angle member which will return an angle. Based on the angle you can determine the direction . For example if the angle is on between say 45 to 135 its is North... something like that

So you can write a GP task or there might be a way to do that client side also using the basic math look in Wikipedia or google it...
0 Kudos
JollyJacob
Emerging Contributor
Thanks Doc, for your feedback. I'm afraid, getting the direction as North, West etc is not sufficient, we need to get it as a vector and then determine which side of the line is left and which is right.

Regards
Jolly
0 Kudos
dotMorten_esri
Esri Notable Contributor
You can use Math.Sin/Cos/Arc* methods for this. Do an online search for trigonometric functions and you should be able to find the math needed.
0 Kudos
JollyJacob
Emerging Contributor
Thanks, Morten. Much appreciated.
0 Kudos