Automate X,Y Fields to construct lines
I am using the SDSFIE model for my datasets. Most of the polyline data contains From X, From Y and To X, To Y fields. Calculate Geometry only gets X,Y centroid of the polyline. The information is stored in each vertex, is there a way to automate the entry of those fields?
Mapping Center Answer:
You’ll need to use a VBA expression in the field calualtor. Use the following code:
Dim Output As Double
Dim pLine As IPolyline
Dim pPoint as IPoint
Set pLine = [Shape]
Set pPoint = pLine.FromPoint
The Output value will be the output of the expression.
Output = pPoint.X
Change FromPoint to ToPoint to get the other end of the line. Also change X to Y for the Y value. So, you’ll need to add 4 fields (ToPointX, ToPointY, FromPointX, FromPointY) and calculate each.
If you would like to post a comment, please login.