AnsweredAssumed Answered

Shapefield naming ...

Question asked by Dan_Patterson Champion on Sep 24, 2014
Latest reply on May 9, 2015 by Dan_Patterson

Curiosity is getting to me.
I  created a test shapefile, in a folder, using the attached code.  I am curious as to why the specified field name wasn't set as an alias (as a minimum) or as the field name.  At least I expected SHAPE@XY to be converted to SHAPE_XY to maintain valid field names.

 

 

The documentation on da.cursors provides a complete list of the available aliases you can use (as per the above example), but I have yet to see where a field name of that name, or its expected variant, has been created, nor have I seen one that exists.

 

 

 

 

To further complicate things, the documentation in many parts of the online help, suggests that the default name for featureclasses is SHAPE in upper-case... yet, at least for shapefiles, it is Shape in proper-case.

 

Can anyone provide me with examples that routinely used files may/will have a geometry field that differs from that observed here?  I am not interested in what 3rd party software might do, but creation with the Arc* line of products.

 

*****construct points for test

 

>>> import arcpy
  >>> path = r"C:\temp"
  >>> name = "Test_pnts.shp"
  >>> arcpy.CreateFeatureclass_management(path, name, "POINT")
  <Result 'C:\\Temp\\Test_pnts.shp'>
  >>> fc = r"C:\temp\Test_pnts.shp"
  >>> cursor = arcpy.da.InsertCursor(fc, ["SHAPE@XY"])
  >>> xy_s = [ [0,0],[100,0],[100,100],[0,100] ]
  >>> for pnt in xy_s:
  ...  cursor.insertRow([pnt])
  ...  
  0L
  1L
  2L
  3L

 

Message was edited by: Dan Patterson fix syntax highlighting

Outcomes