<?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: how to split a polyline into equal segments with python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460439#M36062</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All I am trying to do is highlight a line segment and have to user click somewhere on the line and split it into two segments....user define split. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&amp;nbsp; Trying to do this in an ArcGIS online app or a written JavaScript app.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Apr 2016 16:07:13 GMT</pubDate>
    <dc:creator>jaykapalczynski</dc:creator>
    <dc:date>2016-04-19T16:07:13Z</dc:date>
    <item>
      <title>how to split a polyline into equal segments with python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460436#M36059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to split a road (a line feature) into equal size segment. I know there is a way to do it in ArcGIS (editor-split), but this can not be coded with python script. Is there anyone can help me to code this? Or Any hint could be very helpful.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2014 14:11:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460436#M36059</guid>
      <dc:creator>ruiyang</dc:creator>
      <dc:date>2014-07-03T14:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to split a polyline into equal segments with python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460437#M36060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is something I wrote that will build points along the line that you can then feed to the split by point tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def points_along_line(line_lyr, pnt_layer, pnt_dist):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """
&amp;nbsp;&amp;nbsp;&amp;nbsp; line_lyr (feature layer) - Single part line
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt_layer (feature layer) - Path to point feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt_dist (integer) - Interval distance in map units to add points
&amp;nbsp;&amp;nbsp;&amp;nbsp; """

&amp;nbsp;&amp;nbsp;&amp;nbsp; search_cursor = arcpy.da.SearchCursor(line_lyr, 'SHAPE@')
&amp;nbsp;&amp;nbsp;&amp;nbsp; insert_cursor = arcpy.da.InsertCursor(pnt_layer, 'SHAPE@')

&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in search_cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dist in range(0, int(row[0].length), pnt_dist):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point = row[0].positionAlongLine(dist).firstPoint
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insert_cursor.insertRow([point])
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It was setup to work on an existing point feature class. You could just as easily add a few lines to create it on the fly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not arcpy.Exists(pnt_layer):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; os.path.dirname(pnt_layer), os.path.basename(pnt_layer), 'POINT')
...
&amp;nbsp;&amp;nbsp;&amp;nbsp; return pnt_layer&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then add the split line at point tool where you call the function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
points_along_line(line_features, &lt;STRONG&gt;point_features&lt;/STRONG&gt;, pnt_dist)
arcpy.SplitLineAtPoint_management(line_features, &lt;STRONG&gt;point_features&lt;/STRONG&gt;, out_feature_class)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:29:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460437#M36060</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T20:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to split a polyline into equal segments with python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460438#M36061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Coincidentally, this exact same topic came up in &lt;A href="http://arcpy.wordpress.com/"&gt;ArcPy Café &lt;/A&gt;the other week:&amp;nbsp; &lt;A href="http://arcpy.wordpress.com/2014/10/30/split-into-equal-length-features"&gt;Split into equal length features&lt;/A&gt;.&amp;nbsp; A team member Dave (I don't know him other than his name is Dave) provided a fairly compact and elegant solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 22:15:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460438#M36061</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-11-12T22:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to split a polyline into equal segments with python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460439#M36062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All I am trying to do is highlight a line segment and have to user click somewhere on the line and split it into two segments....user define split. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&amp;nbsp; Trying to do this in an ArcGIS online app or a written JavaScript app.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2016 16:07:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460439#M36062</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-04-19T16:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to split a polyline into equal segments with python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460440#M36063</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/40800"&gt;jay kapalczynski&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;You should really post this question in the &lt;A href="https://community.esri.com/space/2128"&gt;ArcGIS API for JavaScript&lt;/A&gt;​ area.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2016 16:22:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460440#M36063</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-04-19T16:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to split a polyline into equal segments with python</title>
      <link>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460441#M36064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just realized that and just did that…thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jay Kapalczynski&lt;/P&gt;&lt;P&gt;GIS Coordinator - Virginia Department of Game &amp;amp; Inland Fisheries&lt;/P&gt;&lt;P&gt;(new address) 7870 Villa Park Drive Suite 400, Henrico VA 23228&lt;/P&gt;&lt;P&gt;Phone: 804.367.6796 | Fax: 804.367.2628&lt;/P&gt;&lt;P&gt;ü Please consider the environment before printing this email.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2016 16:24:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-split-a-polyline-into-equal-segments-with/m-p/460441#M36064</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2016-04-19T16:24:59Z</dc:date>
    </item>
  </channel>
</rss>

