<?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: ArcGIS 10.0:Python Window-Try to Create a Feature of 12 Points from Txt-Err in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519314#M40656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Curtis,&amp;nbsp; Thanks for your valuable response.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to do the "Make XY Event Layer" as you said.&amp;nbsp; I started to make a csv file for my 12 points (5 Columns: ID, Lot_ID, X_coord, Y_coord, Z_coord) and modified the MakeXYLayer.py to get the input data (ID, Lot_ID, X_coord, Y_coord, and Z), spRef, etc. into the table, geodatabase and mxd Map of ArcGIS 10.0 - please see my draft csv table (sc12points.csv) and scMakelayer.txt attached in this post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# scMakeXYlayer.py&amp;nbsp;&amp;nbsp; for 12 points
# Description: Creates an XY layer and exports it to a layer file
# Author: ESRI - modified by Scott Chang (Date:&amp;nbsp; 04 Oct 2012)

# import system modules 
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/TEMP/WritingGeometries/sc12points"
 
try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the local variables
&amp;nbsp;&amp;nbsp;&amp;nbsp; in_Table = "firestations.csv"
&amp;nbsp;&amp;nbsp;&amp;nbsp; x_coords = "POINT_X"
&amp;nbsp;&amp;nbsp;&amp;nbsp; y_coords = "POINT_Y"
&amp;nbsp;&amp;nbsp;&amp;nbsp; z_coords = "POINT_Z"
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_Layer = "firestations_layer"
&amp;nbsp;&amp;nbsp;&amp;nbsp; saved_Layer = r"c:\output\firestations.lyr"
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the spatial reference
&amp;nbsp;&amp;nbsp;&amp;nbsp; spRef = r"Coordinate Systems\Projected Coordinate Systems\Utm\Nad 1983\NAD 1983 UTM Zone 11N.prj"
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Make the XY event layer...
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords)
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print the total rows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetCount_management(out_Layer)
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Save to a layer file
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
 
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred print the message to the screen
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()
&lt;/PRE&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need your technical exerptise for resolving the following 3 things:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(1)&amp;nbsp; In your "Test.csv", you have 3 columns: rec, X, Y. In my sc12points.csv, I have 5 Columns: ID, Lot_ID, X_coord, Y_coord, Z_coord). How can I read these 5 columns in the "try:" section of the Python Script of my sc12points.txt (this will be changed to .py)?&amp;nbsp; My real problem is: how can I write the ArcPy-Python code statements to read the ID and Lot_ID in the "try:" section?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(2)&amp;nbsp; How can I specify the World 84 coordinates system in the spRef? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(3) I used my Excel 2007 to create my 12points.csv file. I just typed in the names of 5 columns in the first row and then typed in (i) 1, 2, 3, ...., 12 in ID, (ii) Lot_ID, copied the values of X_coord and Y_coord from my old text file to my new csv file, and (iii) leave all the indendations to the right.&amp;nbsp; Do I have to change (i) the types of ID and Lot_ID to integer, (ii) the types of X_coord, Y_coord and Z_coord to float, and (iii) indentation of all the input data to the left?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please kindly help and advise.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott Chang&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:39:08 GMT</pubDate>
    <dc:creator>ScottChang</dc:creator>
    <dc:date>2021-12-11T22:39:08Z</dc:date>
    <item>
      <title>ArcGIS 10.0:Python Window-Try to Create a Feature of 12 Points from Txt-Err</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519312#M40654</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;In a text file, I stored the ID, X-coordinate and Y-coordinate of 12 points - see the attached txt file.&amp;nbsp; I used the Python Window of my ArcGIS 10.0 to execute the following Python script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;gt;&amp;gt;&amp;gt; #////// newWritingGeometries12Points.py ////////////
... # Create a new "Point" feature class using a text file of coordinates.
... #&amp;nbsp;&amp;nbsp; Each coordinate entry is semicolon delimited in the format of ID;X;Y
... # Import ArcPy and other required modules
... #
... import arcpy
... from arcpy import env
... import fileinput
... import string
... import os
... env.overwriteOutput = True
... # Get the coordinate ASCII file
... #
... #infile = arcpy.GetParameterAsText(0)
... infile = r"C:\TEMP\WritingGeometries\WritingGeometries_12Points.txt"
... # Get the output feature class
... # fcname = arcpy.GetParameterAsText(1)
... fcname = r"C:\TEMP\BS_Test.gdb\Points12_fc"
... # Get the template feature class
... #
... # template = arcpy.GetParameterAsText(2)
... template = r"C:\TEMP\BS_Test.gdb\bsInFeatureClass"
... try:
...&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create the output feature class
...&amp;nbsp;&amp;nbsp;&amp;nbsp; #
...&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management(os.path.dirname(fcname),
...&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;&amp;nbsp; os.path.basename(fcname), 
...&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;&amp;nbsp; "Point", template)
...&amp;nbsp;&amp;nbsp;&amp;nbsp; # Open an insert cursor for the new feature class
...&amp;nbsp;&amp;nbsp;&amp;nbsp; #
...&amp;nbsp;&amp;nbsp;&amp;nbsp; cur = arcpy.InsertCursor(fcname)
...&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create an array and point object needed to create features
...&amp;nbsp;&amp;nbsp;&amp;nbsp; #
...&amp;nbsp;&amp;nbsp;&amp;nbsp; pointArray = arcpy.Array()
...&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point()
...&amp;nbsp;&amp;nbsp;&amp;nbsp; # Initialize a variable for keeping track of a feature's ID.
...&amp;nbsp;&amp;nbsp;&amp;nbsp; #
...&amp;nbsp;&amp;nbsp;&amp;nbsp; ID = -1 
...&amp;nbsp;&amp;nbsp;&amp;nbsp; for line in fileinput.input(infile): # Open the input file
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set the point's ID, X and Y properties
...&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.ID, pnt.X, pnt.Y = string.split(line,";")
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print pnt.ID, pnt.X, pnt.Y
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ID == -1:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID = pnt.ID
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Add the point to the feature's array of points
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp; If the ID has changed, create a new feature
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ID != pnt.ID:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a new row or feature, in the feature class
...&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; feat = cur.newRow()
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the geometry of the new feature to the array of points
...&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; feat.shape = pointArray
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Insert the feature
...&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; cur.insertRow(feat)
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointArray.removeAll()
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointArray.add(pnt)
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID = pnt.ID
...&amp;nbsp;&amp;nbsp;&amp;nbsp; # Add the last feature
...&amp;nbsp;&amp;nbsp;&amp;nbsp; #
...&amp;nbsp;&amp;nbsp;&amp;nbsp; feat = cur.newRow()
...&amp;nbsp;&amp;nbsp;&amp;nbsp; feat.shape = pointArray
...&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.insertRow(feat)
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
...&amp;nbsp;&amp;nbsp;&amp;nbsp; pointArray.removeAll()
...&amp;nbsp;&amp;nbsp;&amp;nbsp; fileinput.close()
...&amp;nbsp;&amp;nbsp;&amp;nbsp; del cur
...&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText (0, fcname) # newly added 18Sept2012, per BS.
... except Exception as e:
...&amp;nbsp;&amp;nbsp;&amp;nbsp; print e.message
... 
1&amp;nbsp;&amp;nbsp; -61845879.0968&amp;nbsp;&amp;nbsp; 45047635.4861

2&amp;nbsp;&amp;nbsp; -3976119.96791&amp;nbsp;&amp;nbsp; 46073695.0451

ERROR 999999: Error executing function.

&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;I have no ideas why I got: ERROR 999999: Error executing function.&amp;nbsp; Please kindly help and tell me where I made mistakes and how to resolve this error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott Chang&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 11:39:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519312#M40654</guid>
      <dc:creator>ScottChang</dc:creator>
      <dc:date>2012-10-01T11:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.0:Python Window-Try to Create a Feature of 12 Points from Txt-Err</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519313#M40655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We could dive in deeper on writing geometries, but if all you are working with is points, it's a LOT easier to create a csv file with field headings. Name it "myPoints.csv" and ArcGIS will see it as a table. You can feed that table directly to the MakeXYEventLayer tool. If you need a dataset, just follow that with Copy Features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example file "test.csv":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rec,x,y
1,-74.0,35.0
2,-74.1,35.1
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See the tool help for Make XY Event Layer for an example. Hope this helps!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:39:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519313#M40655</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T22:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.0:Python Window-Try to Create a Feature of 12 Points from Txt-Err</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519314#M40656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Curtis,&amp;nbsp; Thanks for your valuable response.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to do the "Make XY Event Layer" as you said.&amp;nbsp; I started to make a csv file for my 12 points (5 Columns: ID, Lot_ID, X_coord, Y_coord, Z_coord) and modified the MakeXYLayer.py to get the input data (ID, Lot_ID, X_coord, Y_coord, and Z), spRef, etc. into the table, geodatabase and mxd Map of ArcGIS 10.0 - please see my draft csv table (sc12points.csv) and scMakelayer.txt attached in this post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# scMakeXYlayer.py&amp;nbsp;&amp;nbsp; for 12 points
# Description: Creates an XY layer and exports it to a layer file
# Author: ESRI - modified by Scott Chang (Date:&amp;nbsp; 04 Oct 2012)

# import system modules 
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/TEMP/WritingGeometries/sc12points"
 
try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the local variables
&amp;nbsp;&amp;nbsp;&amp;nbsp; in_Table = "firestations.csv"
&amp;nbsp;&amp;nbsp;&amp;nbsp; x_coords = "POINT_X"
&amp;nbsp;&amp;nbsp;&amp;nbsp; y_coords = "POINT_Y"
&amp;nbsp;&amp;nbsp;&amp;nbsp; z_coords = "POINT_Z"
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_Layer = "firestations_layer"
&amp;nbsp;&amp;nbsp;&amp;nbsp; saved_Layer = r"c:\output\firestations.lyr"
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the spatial reference
&amp;nbsp;&amp;nbsp;&amp;nbsp; spRef = r"Coordinate Systems\Projected Coordinate Systems\Utm\Nad 1983\NAD 1983 UTM Zone 11N.prj"
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Make the XY event layer...
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords)
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print the total rows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetCount_management(out_Layer)
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Save to a layer file
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
 
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred print the message to the screen
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()
&lt;/PRE&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need your technical exerptise for resolving the following 3 things:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(1)&amp;nbsp; In your "Test.csv", you have 3 columns: rec, X, Y. In my sc12points.csv, I have 5 Columns: ID, Lot_ID, X_coord, Y_coord, Z_coord). How can I read these 5 columns in the "try:" section of the Python Script of my sc12points.txt (this will be changed to .py)?&amp;nbsp; My real problem is: how can I write the ArcPy-Python code statements to read the ID and Lot_ID in the "try:" section?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(2)&amp;nbsp; How can I specify the World 84 coordinates system in the spRef? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(3) I used my Excel 2007 to create my 12points.csv file. I just typed in the names of 5 columns in the first row and then typed in (i) 1, 2, 3, ...., 12 in ID, (ii) Lot_ID, copied the values of X_coord and Y_coord from my old text file to my new csv file, and (iii) leave all the indendations to the right.&amp;nbsp; Do I have to change (i) the types of ID and Lot_ID to integer, (ii) the types of X_coord, Y_coord and Z_coord to float, and (iii) indentation of all the input data to the left?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please kindly help and advise.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott Chang&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:39:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519314#M40656</guid>
      <dc:creator>ScottChang</dc:creator>
      <dc:date>2021-12-11T22:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.0:Python Window-Try to Create a Feature of 12 Points from Txt-Err</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519315#M40657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&amp;nbsp; &lt;BR /&gt;(1)&amp;nbsp; In your "Test.csv", you have 3 columns: rec, X, Y. In my sc12points.csv, I have 5 Columns: ID, Lot_ID, X_coord, Y_coord, Z_coord). How can I read these 5 columns in the "try:" section of the Python Script of my sc12points.txt (this will be changed to .py)?&amp;nbsp; My real problem is: how can I write the ArcPy-Python code statements to read the ID and Lot_ID in the "try:" section?&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;As long as they are the file, they will come in as columns in the table. You don't need to specify them in the Python code, just in the input file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;(2)&amp;nbsp; How can I specify the World 84 coordinates system in the spRef? &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Specify the appropriate path for spRef. I think what you want is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;spRef = r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;(3) I used my Excel 2007 to create my 12points.csv file. I just typed in the names of 5 columns in the first row and then typed in (i) 1, 2, 3, ...., 12 in ID, (ii) Lot_ID, copied the values of X_coord and Y_coord from my old text file to my new csv file, and (iii) leave all the indendations to the right.&amp;nbsp; Do I have to change (i) the types of ID and Lot_ID to integer, (ii) the types of X_coord, Y_coord and Z_coord to float, and (iii) indentation of all the input data to the left?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think it matters that much, whitespace around column delimeters is usualy ignored,&amp;nbsp; and the field types are defined from the data as it is read.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 19:22:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519315#M40657</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-10-04T19:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.0:Python Window-Try to Create a Feature of 12 Points from Txt-Err</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519316#M40658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Curtis,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In the Python Window of my ArcGIS 10.0, I executed the following Python script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; # scMakeXYlayer.py&amp;nbsp;&amp;nbsp; for 12 points
... # Description: Creates an XY layer and exports it to a layer file
... # Author: ESRI - modified by Scott Chang (Date:&amp;nbsp; 04 Oct 2012)
... # import system modules 
... import arcpy
... from arcpy import env
... # Set environment settings
... env.workspace = "C:/TEMP/WritingGeometries/sc12points"
...&amp;nbsp; 
... try:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the local variables
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in_Table = "firestations.csv"
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x_coords = "POINT_X"
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y_coords = "POINT_Y"
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z_coords = "POINT_Z"
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_Layer = "firestations_layer"
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; saved_Layer = r"c:\TEMP\firestations.lyr"
...&amp;nbsp; 
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the spatial reference
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spRef = r"Coordinate Systems\Projected Coordinate Systems\Utm\Nad 1983\NAD 1983 UTM Zone 11N.prj"
...&amp;nbsp; 
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Make the XY event layer...
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords)
...&amp;nbsp; 
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print the total rows
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetCount_management(out_Layer)
...&amp;nbsp; 
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Save to a layer file
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
...&amp;nbsp; 
... except:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred print the message to the screen
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()
... 
Executing: MakeXYEventLayer firestations.csv POINT_X POINT_Y firestations_layer "PROJCS['NAD_1983_UTM_Zone_11N',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-117.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]];-5120900 -9998100 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision" POINT_Z
Start Time: Tue Oct 09 14:47:53 2012
Failed to execute. Parameters are not valid.
ERROR 000732: XY Table: Dataset firestations.csv does not exist or is not supported
Failed to execute (MakeXYEventLayer).
Failed at Tue Oct 09 14:47:53 2012 (Elapsed Time: 0.00 seconds)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have no ideas why I got "Failed to execute. Parameters are not valid.&amp;nbsp; ERROR 000732: XY Table....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please kindly help and tell me how I can fix the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott Chang&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;P. S.&amp;nbsp; This Forum does not take the csv file. So I used the txt file attached in this post for the input data.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:39:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-python-window-try-to-create-a-feature/m-p/519316#M40658</guid>
      <dc:creator>ScottChang</dc:creator>
      <dc:date>2021-12-11T22:39:11Z</dc:date>
    </item>
  </channel>
</rss>

