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

Taras
  • 32,823
  • 4
  • 66
  • 137
tigerwoulds
  • 599
  • 5
  • 17
  • 2
    https://gis.stackexchange.com/questions/201867/create-a-line-perpendicular-to-an-existing-line-in-arcgis/201871#201871 – FelixIP Jun 11 '20 at 19:33

3 Answers3

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

GBG
  • 9,737
  • 1
  • 15
  • 44
  • 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. – tigerwoulds Jun 11 '20 at 18:56
  • Yes, you would need to split your lines before using this tool. – GBG Jun 11 '20 at 21:18
  • Was able to implement the Start and End tools into my model and it works flawlessly. Thanks so much! – tigerwoulds Jun 12 '20 at 14:17
  • 1
    This tool has been updated to work with ArcPro. See this link: https://github.com/gerry1138/Create-Perpendicular-Lines-ArcPro-Python3- – GBG Jun 12 '20 at 18:23
  • 1
    Looks like the link above doesnt work anymore. Could you please check it? Thanks! – tigerwoulds Sep 30 '20 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.

tigerwoulds
  • 599
  • 5
  • 17
  • I would be interested in what error the script threw. – GBG Oct 06 '20 at 03: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. – tigerwoulds Oct 06 '20 at 13:54