<?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: Draw Perpendicular Line. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225856#M17499</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;he wants normal to the x-axis rather than your example of normal to the line, &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Feb 2016 17:15:58 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-02-25T17:15:58Z</dc:date>
    <item>
      <title>Draw Perpendicular Line.</title>
      <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225852#M17495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone suggest me to draw the perpendicular line for very point automatically using python/arcobject. That Perpendicular line touch with line feature. Kindly reference the below image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Error.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/187692_Error.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2016 08:29:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225852#M17495</guid>
      <dc:creator>RajP</dc:creator>
      <dc:date>2016-02-25T08:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Perpendicular Line.</title>
      <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225853#M17496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/19932"&gt;Darren Wiens&lt;/A&gt;​ posted some &lt;A _jive_internal="true" href="https://community.esri.com/message/540119#comment-540119"&gt;code here &lt;/A&gt;​which should get you started.&amp;nbsp; Your normals are to the X-axis rather than relative to the line.&amp;nbsp; You can construct an intersecting line relative to that axis which should give you the necessary point intersection on your line and hence the point-line segment &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2016 10:58:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225853#M17496</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-25T10:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Perpendicular Line.</title>
      <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225854#M17497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code below seems to do the job, BUT this is based on a single line. If you have several polylines you will have to include logic to select the polyline to "snap to".&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/187699_pastedImage_31.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_lines = r'D:\Xander\GeoNet\Perpendicular\data.gdb\lines'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_points = r'D:\Xander\GeoNet\Perpendicular\data.gdb\points'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_out = r'D:\Xander\GeoNet\Perpendicular\data.gdb\result'
&amp;nbsp;&amp;nbsp;&amp;nbsp; tolerance = 15000

&amp;nbsp;&amp;nbsp;&amp;nbsp; # get first line
&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline = arcpy.da.SearchCursor(fc_lines, ('SHAPE@')).next()[0]

&amp;nbsp;&amp;nbsp;&amp;nbsp; lines = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(fc_points, ('SHAPE@')) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line = createVerticalLine(pnt.firstPoint, tolerance, pnt.spatialReference)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mp = getIntersectingPoints(line, polyline)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if mp.pointCount &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt2 = getNearestPoint(mp, pnt.firstPoint)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vert_line = arcpy.Polyline(arcpy.Array([pnt.firstPoint, pnt2]),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt.spatialReference)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lines.append(vert_line)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # no intersecting within tolerance
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(lines, fc_out)

def createVerticalLine(pnt, tolerance, sr):
&amp;nbsp;&amp;nbsp;&amp;nbsp; return arcpy.Polyline(arcpy.Array([arcpy.Point(pnt.X, pnt.Y+tolerance),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Point(pnt.X, pnt.Y-tolerance)]),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr)

def getIntersectingPoints(line, polyline):
&amp;nbsp;&amp;nbsp;&amp;nbsp; return polyline.intersect(line, 1)

def getNearestPoint(mp, pnt):
&amp;nbsp;&amp;nbsp;&amp;nbsp; nearest_pnt = None
&amp;nbsp;&amp;nbsp;&amp;nbsp; for p in mp:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if nearest_pnt is None:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nearest_pnt = p
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min_dist = getDistance(p, pnt)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dist = getDistance(p, pnt)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if dist &amp;lt; min_dist:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nearest_pnt = p
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min_dist = dist
&amp;nbsp;&amp;nbsp;&amp;nbsp; return nearest_pnt

def getDistance(p1, p2):
&amp;nbsp;&amp;nbsp;&amp;nbsp; import math
&amp;nbsp;&amp;nbsp;&amp;nbsp; return math.sqrt((p1.X-p2.X)**2 + (p1.Y-p2.Y)**2)

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:59:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225854#M17497</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T10:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Perpendicular Line.</title>
      <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225855#M17498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you looking for a perpendicular line (90 degrees to the line, as I've added below) or a vertical line (as you've drawn)?&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="187753" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/187753_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2016 16:35:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225855#M17498</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-02-25T16:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Perpendicular Line.</title>
      <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225856#M17499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;he wants normal to the x-axis rather than your example of normal to the line, &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2016 17:15:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225856#M17499</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-02-25T17:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Perpendicular Line.</title>
      <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225857#M17500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;I need vertical line for each point and touch with line feature.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 06:15:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225857#M17500</guid>
      <dc:creator>RajP</dc:creator>
      <dc:date>2016-03-01T06:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Perpendicular Line.</title>
      <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225858#M17501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IProximityOperator proximity = &amp;lt;&amp;lt;PolylineFeature&amp;gt;&amp;gt;.ShapeCopy as IProximityOperator;&lt;/P&gt;&lt;P&gt;IPoint out_point = proximity.ReturnNearestPoint(&amp;lt;&amp;lt;input point&amp;gt;&amp;gt;, esriSegmentExtension.esriExtendTangentAtFrom);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code, it will create perpendicular lines&amp;nbsp;to given point.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 May 2017 06:40:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225858#M17501</guid>
      <dc:creator>M_DJohnson</dc:creator>
      <dc:date>2017-05-20T06:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Perpendicular Line.</title>
      <link>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225859#M17502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;True, but if you look at the examples you will see that it was not a perpendicular line the OP was looking for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 May 2017 14:21:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/draw-perpendicular-line/m-p/225859#M17502</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2017-05-20T14:21:34Z</dc:date>
    </item>
  </channel>
</rss>

