<?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: Trouble with writing feature to shapefile in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/trouble-with-writing-feature-to-shapefile/m-p/400946#M31562</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks it worked&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Apr 2014 14:44:25 GMT</pubDate>
    <dc:creator>MarionConstante</dc:creator>
    <dc:date>2014-04-01T14:44:25Z</dc:date>
    <item>
      <title>Trouble with writing feature to shapefile</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-writing-feature-to-shapefile/m-p/400944#M31560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I created a new shapefile and using the cursor I'm trying to add data to the new shapefile using an array.&amp;nbsp; When I run the python script this always shows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;feat.shape = pointArray&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\arcobjects\_base.py", line 35, in __setattr__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return setattr(self._arc_object, attr, ao)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code snippet for the cursor is (in bold is what seems to be the problem):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output = "Points.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management("C:/workspace", output, "POINT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur = arcpy.InsertCursor(output)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointArray = arcpy.Array()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # start point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (start.ID, start.X, start.Y) = (1, origin_x, origin_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointArray.add(start)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # end point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end = arcpy.Point()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (end.ID, end.X, end.Y) = (2, end_x, end_y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointArray.add(end)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat = cur.newRow()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat.shape = pointArray&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.insertRow(feat)&lt;BR /&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts, I am still new to python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2014 23:12:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-writing-feature-to-shapefile/m-p/400944#M31560</guid>
      <dc:creator>MarionConstante</dc:creator>
      <dc:date>2014-03-31T23:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with writing feature to shapefile</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-writing-feature-to-shapefile/m-p/400945#M31561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Marion,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that you're initially creating a shapefile with type "POINT", but then trying to write Polylines to it. Change the create feature class layer to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.CreateFeatureclass_management("C:/workspace", output, "POLYLINE")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Shaun&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:17:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-writing-feature-to-shapefile/m-p/400945#M31561</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-12-11T18:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with writing feature to shapefile</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-writing-feature-to-shapefile/m-p/400946#M31562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks it worked&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Apr 2014 14:44:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-writing-feature-to-shapefile/m-p/400946#M31562</guid>
      <dc:creator>MarionConstante</dc:creator>
      <dc:date>2014-04-01T14:44:25Z</dc:date>
    </item>
  </channel>
</rss>

