<?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: Creating Polylines with Z-values very slow in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612473#M47780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this would help, but perhaps this is causing the issue?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
cursor = arcpy.da.InsertCursor(shpname, ["SHAPE@"])
for f in featureList:
&amp;nbsp;&amp;nbsp; cursor.insertRow(&lt;F&gt;)
&lt;/F&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

with arcpy.da.InsertCursor(shpname, ["SHAPE@"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.insertRow([featureList])

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:11:30 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-12-12T02:11:30Z</dc:date>
    <item>
      <title>Creating Polylines with Z-values very slow</title>
      <link>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612472#M47779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i am creating Polylines from scrath out of X,Y,Z-Points.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need PolylineZ. When I create Polylines using arcpy.Polyline i use the Parameter "has_z = True".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If i use this Parameter, i get PolylineZ but it works that slow that the script is un-useable for me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Without this paramater the script works fine and fast but without having Z-values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can i make the script faster? Has someone an idea?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;lineArray = arcpy.Array()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pnt = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for f in list:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pnt.X = ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pnt.Y = ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pnt.Z = ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; lineArray.add(pnt)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; feature = arcpy.Polyline(lineArray, "None",&lt;/SPAN&gt;&lt;STRONG&gt; True&lt;/STRONG&gt;&lt;SPAN&gt;, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; featureList.append(feature)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; lineArray.removeAll()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cursor = arcpy.da.InsertCursor(shpname, ["SHAPE@"])&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for f in featureList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; cursor.insertRow(&lt;F&gt;)&lt;/F&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 06:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612472#M47779</guid>
      <dc:creator>AndreasKrueger</dc:creator>
      <dc:date>2013-07-18T06:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Polylines with Z-values very slow</title>
      <link>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612473#M47780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this would help, but perhaps this is causing the issue?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
cursor = arcpy.da.InsertCursor(shpname, ["SHAPE@"])
for f in featureList:
&amp;nbsp;&amp;nbsp; cursor.insertRow(&lt;F&gt;)
&lt;/F&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

with arcpy.da.InsertCursor(shpname, ["SHAPE@"]) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.insertRow([featureList])

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:11:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612473#M47780</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-12T02:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Polylines with Z-values very slow</title>
      <link>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612474#M47781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi jamesfreddyc,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for your reply,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the insertCursor-function is &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; the time killer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the function &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;arcpy.Polyline()&lt;/SPAN&gt;&lt;SPAN&gt; is fast fithout the Parameter "has_z"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Synatx = Polyline (inputs, {spatial_reference}, {has_z}, {has_m})&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;polyline = arcpy.Polyline(array)&amp;nbsp;&amp;nbsp;&amp;nbsp; #this one is fast as expected&lt;BR /&gt;&lt;BR /&gt;polyline = arcpy.Polyline(array, &amp;lt;none&amp;gt;,&amp;nbsp; True, False)&amp;nbsp;&amp;nbsp;&amp;nbsp; #this one is very very very slow&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 06:23:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612474#M47781</guid>
      <dc:creator>AndreasKrueger</dc:creator>
      <dc:date>2013-07-19T06:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Polylines with Z-values very slow</title>
      <link>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612475#M47782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi jamesfreddyc,&lt;BR /&gt;&lt;BR /&gt;thanks for your reply,&lt;BR /&gt;&lt;BR /&gt;the insertCursor-function is &lt;SPAN style="text-decoration:underline;"&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/SPAN&gt; the time killer.&lt;BR /&gt;&lt;BR /&gt;the function &lt;SPAN style="font-style:italic;"&gt;arcpy.Polyline()&lt;/SPAN&gt; is fast fithout the Parameter "has_z"&lt;BR /&gt;&lt;BR /&gt;for example:&lt;BR /&gt;&lt;BR /&gt;Synatx = Polyline (inputs, {spatial_reference}, {has_z}, {has_m})&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;polyline = arcpy.Polyline(array)&amp;nbsp;&amp;nbsp;&amp;nbsp; #this one is fast as expected&lt;BR /&gt;&lt;BR /&gt;polyline = arcpy.Polyline(array, &amp;lt;none&amp;gt;,&amp;nbsp; True, False)&amp;nbsp;&amp;nbsp;&amp;nbsp; #this one is very very very slow&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Okay, perhaps this is the issue:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"...When using InsertCursor on a point feature class, creating a PointGeometry and &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;setting it to the SHAPE@ token is a comparatively expensive operation&lt;/SPAN&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Instead, define the point feature using tokens such as&lt;/SPAN&gt;&lt;SPAN&gt; SHAPE@XY, &lt;/SPAN&gt;&lt;STRONG&gt;SHAPE@Z&lt;/STRONG&gt;&lt;SPAN&gt;, and SHAPE@M for faster, more efficient access."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will look for an example of setting SHAPE@Z&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 11:31:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612475#M47782</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2013-07-19T11:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Polylines with Z-values very slow</title>
      <link>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612476#M47783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I come up with the same issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone found a solution yet?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The last suggestion&amp;nbsp; jamesfreddyc did works for point features, not for polyline features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers, Koen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Dec 2013 13:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-polylines-with-z-values-very-slow/m-p/612476#M47783</guid>
      <dc:creator>KoenVolleberg</dc:creator>
      <dc:date>2013-12-06T13:41:09Z</dc:date>
    </item>
  </channel>
</rss>

