<?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: Split Polylines at certain increments in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014908#M59451</link>
    <description>&lt;P&gt;It is also easy enough to add transect lines, just do one for each axis orientation.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/transect-lines-parallel-lines-offset-lines/ba-p/902792" target="_blank"&gt;Transect lines, parallel lines, offset lines - GeoNet, The Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Since it appears that you are working with a road network you north-south lines will always have offsets which are reflected in the grid pattern&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/split.htm" target="_blank"&gt;Split (Analysis)—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;would be useful, but not on a micro scale.&amp;nbsp; You would have to use "cut" in&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/polygon.htm" target="_blank"&gt;Polygon—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;if you want to code&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2021 22:50:39 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-01-07T22:50:39Z</dc:date>
    <item>
      <title>Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014377#M59419</link>
      <description>&lt;P&gt;I need to create a polyline grid with&amp;nbsp;vertical and horizontal lines of increments of one hundred, somehow divide each polyline/polygon by 9 and across multiple polygons/polylines and I am not sure on how go about doing it. What I have is the polygons/sections and polylines/sections lines.. The polygons/polylines are NOT evenly squared so I can't use fish net, at least I don't think...?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Grid.png" style="width: 710px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3326i0C2A7CAF915505F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Grid.png" alt="Grid.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 19:10:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014377#M59419</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-01-06T19:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014402#M59420</link>
      <description>&lt;P&gt;Can you give some more context?&lt;/P&gt;&lt;P&gt;What's the purpose of this?&lt;/P&gt;&lt;P&gt;What are the blue lines, I'm guessing gridlines but what projection etc. and why are they not regular?&lt;/P&gt;&lt;P&gt;What is 'range'? I might think its the length and width of the blue squares, but then you say you need increments of 100, which throws me off.&amp;nbsp; Also 100 what? Which ones are polygons and which are polylines?&lt;/P&gt;&lt;P&gt;Finally, what's the increase from right to left, and of what units?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 19:46:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014402#M59420</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-06T19:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014407#M59421</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-fishnet.htm" target="_blank"&gt;Create Fishnet (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;you can and could always specify the width and height of each rectangle... just specify a polyline output&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 19:53:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014407#M59421</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-01-06T19:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014432#M59422</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;, it seems like you could use Fishnet with some combination of cell size, cell count, or extent.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 20:47:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014432#M59422</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-01-06T20:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014445#M59423</link>
      <description>&lt;P&gt;This would be used as an addressing grid.&lt;/P&gt;&lt;P&gt;The blue lines would be a whole section.&lt;/P&gt;&lt;P&gt;Range - address range, increase from right to left and south to north.&lt;/P&gt;&lt;P&gt;I guess I just need each sections to be broken into just 9 sections not 100.&lt;/P&gt;&lt;P&gt;The increase from right to left is just a 1000 of possible addresses.&lt;/P&gt;&lt;P&gt;Hopefully that helps.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 21:21:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014445#M59423</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-01-06T21:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014452#M59424</link>
      <description>&lt;P&gt;Just do the mental math to come up with the rectangle width and height.&amp;nbsp; There is no point in coming up with some script when the tools is already available for use.&lt;/P&gt;&lt;P&gt;Once you have the grid you can convert it to singleparts, explode it into segments., reorient line segments etc etc&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 21:33:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014452#M59424</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-01-06T21:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014463#M59425</link>
      <description>&lt;P&gt;I have been messing the fishnet tool for a while and can't produce what i need.&lt;/P&gt;&lt;P&gt;I am thinking that some how each section length &amp;amp; high has to be calculated then divided evenly by 9 times?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdaFishnetSections.png" style="width: 374px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3344iB549D601AEB3CA5A/image-size/large?v=v2&amp;amp;px=999" role="button" title="AdaFishnetSections.png" alt="AdaFishnetSections.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 22:02:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014463#M59425</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-01-06T22:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014471#M59426</link>
      <description>&lt;P&gt;Convert each section to a polygon just so it's easier to identify the extent of each one individually. Then pick one to be the template extent object of the fishnet extent and choose&amp;nbsp;number_rows = 9 and&amp;nbsp;number_columns = 9. Repeat that for each polygon section. You may need to clean up the edges a bit.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 22:17:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014471#M59426</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-01-06T22:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014902#M59449</link>
      <description>&lt;P&gt;Surely I am not the only one that has need to do this and I was hopping there would be something automated since what you describe would be time consuming but I appreciate the suggestion.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 22:35:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014902#M59449</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-01-07T22:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014905#M59450</link>
      <description>&lt;P&gt;You can automate this process by iterating over each polygon with a search cursor.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 22:40:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014905#M59450</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-01-07T22:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014908#M59451</link>
      <description>&lt;P&gt;It is also easy enough to add transect lines, just do one for each axis orientation.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/transect-lines-parallel-lines-offset-lines/ba-p/902792" target="_blank"&gt;Transect lines, parallel lines, offset lines - GeoNet, The Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Since it appears that you are working with a road network you north-south lines will always have offsets which are reflected in the grid pattern&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/split.htm" target="_blank"&gt;Split (Analysis)—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;would be useful, but not on a micro scale.&amp;nbsp; You would have to use "cut" in&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/polygon.htm" target="_blank"&gt;Polygon—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;if you want to code&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 22:50:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1014908#M59451</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-01-07T22:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Split Polylines at certain increments</title>
      <link>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1015150#M59475</link>
      <description>&lt;P&gt;I was able to achieve creating the blocks with the following below but would be nice if could have populate the attributes based on a formula and this is beyond me. I attached the sections in case anyone wants to help out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os

arcpy.env.overwriteOutput = True

def CreateFishnetsForFeats(shp, out, cell_x=0, cell_y=0, n_rows=0, n_cols=0):
    # Create file gdb to store data
    gdb = str(arcpy.CreateFileGDB_management(out, 'Fishnets.gdb').getOutput(0))

    # spatial reference
    arcpy.env.outputCoordinateSystem = arcpy.Describe(shp).spatialReference

    # Loop thru rows of input polygons
    with arcpy.da.SearchCursor(shp, ['SHAPE@', 'OID@']) as rows:
        for row in rows:
            ext = row[0].extent
            st = '%f %f' %(ext.XMin, ext.YMin)
            ort = '%f %f' %(ext.XMin, ext.YMax)

            # Create fishnet
            outFn = os.path.join(gdb, 'fish_{0}'.format(row[1]))
            arcpy.CreateFishnet_management(outFn, st, ort, cell_x,cell_y, n_rows, n_cols,
                                           labels='NO_LABELS',template = ext,
                                           geometry_type='POLYGON')

    # set workspace to new gdb
    arcpy.env.workspace = gdb
    fishnets = arcpy.ListFeatureClasses()
    targ = fishnets[0]
    for i, fish in enumerate(fishnets):
        # Add field for original polygon ID
        fid = fish.split('_')[1]
        arcpy.AddField_management(fish, 'POLY_ID', 'LONG')
        with arcpy.da.UpdateCursor(fish, ['POLY_ID']) as rows:
            for row in rows:
                row[0] = fid
                rows.updateRow(row)
                
        # append fishnets into one feature class
        if i &amp;gt; 0:
            arcpy.Append_management([fish], targ, 'NO_TEST')
            arcpy.Delete_management(fish)
            print (*'Appended: {0}'.format(fish))
    print ('Done')
    return

if __name__ == '__main__':
    polys = r'C:\Temp\SectionGrid\SectionsCopy.shp'
    loc = r'C:\TEMP'
    CreateFishnetsForFeats(polys, loc, 0, 0, 9, 9)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 08 Jan 2021 18:36:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/split-polylines-at-certain-increments/m-p/1015150#M59475</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-01-08T18:36:30Z</dc:date>
    </item>
  </channel>
</rss>

