<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Perpendicular transects at regular intervals in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246648#M8493</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried this code and found more than a few inconsistencies in it. Is there a tested version that we can experiment with?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Feb 2012 14:16:18 GMT</pubDate>
    <dc:creator>JamieKass</dc:creator>
    <dc:date>2012-02-27T14:16:18Z</dc:date>
    <item>
      <title>Perpendicular transects at regular intervals</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246646#M8491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm working on my thesis research analyzing shoreline change and can't seem to figure out how to cast the transects that I need to. I already have a baseline generated from which I will be able to measure shoreline change. From this baseline I need to cast a perpendicular transect every 75 meters. There are four sites in my research and doing this manually would be too time consuming. Any ideas about how to generate these transects with a python script? I understand that you can write geometries using arcpy, but can't figure out how to generate a line feature with a specified origin, orientation, and length. Any help would be much appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Phil&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Michigan State University&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Department of Geography&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MS Graduate Student&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 18:03:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246646#M8491</guid>
      <dc:creator>PhillipeWernette1</dc:creator>
      <dc:date>2012-02-02T18:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Perpendicular transects at regular intervals</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246647#M8492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You might be able to adapt this script to your needs. It makes lines perpendicular to roads (culverts) at given points.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, math, random

#Read parameters
linefc = arcpy.GetParameterAsText(0) #Roads feature class
pointfc = arcpy.GetParameterAsText(1) #Known stream crossings feature class
linefolder = arcpy.GetParameterAsText(2) #Workspace for culverts output
culvertlen = int(arcpy.GetParameterAsText(3))

#Create intermediate and final feature classes
linefc2 = linefolder + "/culverts" #Culverts file path
pointfc2 = "in_memory/temppoints" #Intermediate, artificial crossings
arcpy.CreateFeatureclass_management("in_memory", "temppoints", "POINT", "#", "#", "#", r"Coordinate Systems/Projected Coordinate Systems/Utm/Nad 1983/NAD 1983 UTM Zone 11N.prj")
arcpy.CreateFeatureclass_management(linefolder, "culverts", "POLYLINE", "#", "#", "#", r"Coordinate Systems/Projected Coordinate Systems/Utm/Nad 1983/NAD 1983 UTM Zone 11N.prj")

#Delete any existing features in culverts or artificial crossings
if arcpy.Exists(pointfc2):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(pointfc2)
if arcpy.Exists(linefc2):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(linefc2)

#Find all crossings within 10m of a road
arcpy.Near_analysis(pointfc, linefc, "10 Meters")

#Find shape field in stream crossing feature class
desc = arcpy.Describe(pointfc)
pointshapefield = desc.ShapeFieldName

#Create search and insert cursors
rows = arcpy.SearchCursor(pointfc)
insrow = arcpy.InsertCursor(pointfc2)

#Enter for loop to create artificial crossings offset within 1m2 from actual crossing points

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Continue if the crossing is &amp;lt;10m from a road
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.NEAR_DIST != -1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat = row.getValue(pointshapefield)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt1 = feat.getPart()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt1x = pnt1.X
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt1y = pnt1.Y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Offset artificial crossing &amp;lt;=1m in X, &amp;lt;=1m in Y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; randomX = random.random()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if randomX%2==0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; randomX = randomX * -1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; randomY = random.random()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if randomY%2==0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; randomY = randomY * -1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2x = pnt1.X + randomX
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2y = pnt1.Y + randomY
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Insert new point into feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat2 = insrow.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2 = arcpy.CreateObject("Point")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2.X = pnt2x
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2.Y = pnt2y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat2.shape = pnt2
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insrow.insertRow(feat2)

del row
del insrow
del rows

#Calculate angle to nearest road
arcpy.Near_analysis(pointfc2, linefc, "11 Meters", "#", "ANGLE")

#Create search and insert cursors
rows2 = arcpy.SearchCursor(pointfc2)
insrow2 = arcpy.InsertCursor(linefc2)

#Find shape field
desc2 = arcpy.Describe(pointfc2)

#Create array to hold new lines
lineArray = arcpy.CreateObject("Array")&amp;nbsp;&amp;nbsp;&amp;nbsp; 

#Enter for loop to create culverts

for row2 in rows2:
&amp;nbsp;&amp;nbsp;&amp;nbsp; feat = row2.getValue(desc2.ShapeFieldName)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt1 = feat.getPart()
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt1rad = math.radians(row2.NEAR_ANGLE)
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create point at far end of culvert 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2 = arcpy.CreateObject("Point")
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2.X = (math.cos(pnt1rad) * ((culvertlen/2) + row2.NEAR_DIST)) + pnt1.X
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2.Y = (math.sin(pnt1rad) * ((culvertlen/2) + row2.NEAR_DIST)) + pnt1.Y
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create point at close end of culvert
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt3 = arcpy.CreateObject("Point")
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt3.X = (-1*(math.cos(pnt1rad) * ((culvertlen/2) - row2.NEAR_DIST))) + pnt1.X
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt3.Y = (-1*(math.sin(pnt1rad) * ((culvertlen/2) - row2.NEAR_DIST))) + pnt1.Y
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Put points in array
&amp;nbsp;&amp;nbsp;&amp;nbsp; lineArray.add(pnt3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; lineArray.add(pnt2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; feat3 = insrow2.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Connect points and insert into feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp; feat3.shape = lineArray
&amp;nbsp;&amp;nbsp;&amp;nbsp; insrow2.insertRow(feat3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Erase points from array for next loop
&amp;nbsp;&amp;nbsp;&amp;nbsp; lineArray.removeAll()
del row2
del insrow2
del rows2&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:16:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246647#M8492</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T12:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Perpendicular transects at regular intervals</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246648#M8493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried this code and found more than a few inconsistencies in it. Is there a tested version that we can experiment with?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2012 14:16:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246648#M8493</guid>
      <dc:creator>JamieKass</dc:creator>
      <dc:date>2012-02-27T14:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Perpendicular transects at regular intervals</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246649#M8494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I assume most of the problems you see are due to how it decides which direction to draw the line - it places a random point within a meter of the original point, then connects it perpendicularly to the line. If the random point falls exactly on the line, it can't calculate which direction to draw the line, so it draws horizontally. I used this to create about 10,000 new lines and had to manually change about 100. If I needed higher accuracy than 1m or if it drew many more horizontal lines, I would probably change it, but I don't so I won't.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2012 14:37:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/perpendicular-transects-at-regular-intervals/m-p/246649#M8494</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2012-02-27T14:37:01Z</dc:date>
    </item>
  </channel>
</rss>

