You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - Geoprocessing Scripting (Python, JavaScript, VB) forum

Angle between Line Segments, find adjacent...   Thilo Wiertz Jul 17, 2005
Re: Angle between Line Segments, find adjac...   Brian Svanvik Feb 01, 2006
Re: Angle between Line Segments, find adjac...   Dan Patterson Feb 01, 2006
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Angle between Line Segments, find adjacent Segments 
Author Thilo Wiertz 
Date Jul 17, 2005 
Message Hi all,
I'm facing some problems working on a street layer (shape file) in ArcInfo 9. The task is the following: I'd like to write a macro that goes through all line segments of a layer and checks the angle to adjacent segments. If the angle between two line segments is less than a minimum angle (let's say e.g. 10 degrees), it should merge those two segments.

I'm an absolute beginner in VBA and also quiet new to ArcGIS, so there might be simpel answers to my questions:

First question would be: All line segments have a start and end point which i can get from the segment i'm working with. But what would be the approach to find out if this, let's say end point, also belongs to another segment? (Is it actually the same point, or just another point with same coordinates?) More generally: How can I get hold of adjacent segments?

Second, it seems simple to get the angle between two straight line segments (using the angle with the x-axis of both segments, assuming i solved question 1), but what about curved segments? in this case the script should use the angle at the node, meaning the tangent to the curve.

I already searched the forums and found some basic ideas but not really enough for me to solve this task. I'd really appreciate any hints that could help. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Angle between Line Segments, find adjacent Segments 
Author Brian Svanvik 
Date Feb 01, 2006 
Message Hello!

Did you ever find a solution to this problem, I know this was a long time ago but I've recently come across a similar problem with streams in my territory. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Angle between Line Segments, find adjacent Segments 
Author Dan Patterson 
Date Feb 01, 2006 
Message if you have a list of points derived from a searchcursor, you can use the def below to determin the angle formed by the 3 points. Tip, insert the first point into the end of the list if this is derived from a polyline featureclass 
 
def p1p2p3Angle(pnt1, pnt2, pnt3):
  #Determines the angle formed by 3 points
  #usage theAngle=GeomHelp.p1p2p3Angle(pnt1, pnt2, pnt3)
  Angle1=p1p2Azimuth(pnt1,pnt2)
  Angle2=p1p2Azimuth(pnt2,pnt3)
  theAngle=180.0-(Angle2-Angle1)
  if(theAngle<0):
    theAngle=360+theAngle
  elif(theAngle>360):
    theAngle=theAngle-360
  return theAngle
 
  Geomatics, Carleton University, Ottawa, Canada