2

Using ArcPy, I'm trying to figure out how to draw perpendicular lines along my Streams feature class. I have a set of points, that are snapped to my stream centerline.

I've seen the "Generate Transects Along Line" tool and I think that will get me close, but I'm not sure how to define that I want the lines are drawn at the point locations, rather than a set interval. Here is an example of what I'm trying to accomplish:

enter image description here

1

3 Answers 3

4

Here is a link to a Github repository for an ArcGIS 10.x toolbox tool (and Python script) that will create perpendicular lines at user defined distances. Lines can be created at the midpoint, start node, end node, and either or both sides. If you want to create lines at midpoints the tool will look at the start and end node of that line and create the perpendicular line perpendicular to that imaginary line. Your lines will need to be using a projected coordinate reference system like UTM or State plane. All units of measure would be in the units of the CRS.

https://github.com/ShuksanGeomatics/Create_Perpendicular_Lines_ArcGIS

5
  • Interesting thanks! I could maybe split my lines at the points, then run the Create Perpendicular Lines at Start followed by the Create perp lines at End tools. Will try to figure out how to incorporate that into my existing script so it can all be done at once. Commented Jun 11, 2020 at 18:56
  • Yes, you would need to split your lines before using this tool.
    – GBG
    Commented Jun 11, 2020 at 21:18
  • Was able to implement the Start and End tools into my model and it works flawlessly. Thanks so much! Commented Jun 12, 2020 at 14:17
  • 1
    This tool has been updated to work with ArcPro. See this link: github.com/gerry1138/Create-Perpendicular-Lines-ArcPro-Python3-
    – GBG
    Commented Jun 12, 2020 at 18:23
  • 1
    Looks like the link above doesnt work anymore. Could you please check it? Thanks! Commented Sep 30, 2020 at 18:42
1

Use Generate Transects Along Line with the following python code:

import arcpy

input_path = "path/to/stream"
output_path = "path/to/cross-sections"

distance_interval = "100 FEET" #distance between cross sections
cross_section_length = "50 FEET" 

arcpy.management.GenerateTransectsAlongLines(input_path, output_path, distance_interval, cross_section_length, "END_POINTS")

See here for more: https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/generate-transects-along-lines.htm

0

Although @GBG 's toolbox did work, I ended up using the Generate Transects Along Line tool since I wasn't concerned with which endpoint I wanted to create features. I split my lines at the points using the Split Line at Point tool then ran the Generate Transects Along Line tool using the 'END_POINTS' parameter. Leaving the other answer as accepted because it did solve my problem. But I wanted to provide another workflow in case anyone else is trying to accomplish this.

2
  • I would be interested in what error the script threw.
    – GBG
    Commented Oct 6, 2020 at 3:27
  • It did not throw an error. Actually worked as expected, so thanks again! I just ended up figuring out a workflow using out of the box tools. Commented Oct 6, 2020 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.