Below is a code snippet that I have extracted from something that I am working on. It should create two polyline features: the first is expected to be tiny, while the second is expected to be small.
The small polyline is created as expected, but the tiny line is created as a feature of zero length when I think it should be about 4 metres long.
I have experimented with setFalseOriginAndUnits on the SpatialReference object to see if I can get a greater than zero length but have been unsuccessful. I thought that this was worth trying on the basis of my learnings at Controlling XY Resolution on file geodatabase feature class output from Append?
How can I get this tiny feature to be created with a tiny but not zero length?
import arcpy if arcpy.Exists("C:/Temp/test.gdb"): arcpy.Delete_management("C:/Temp/test.gdb") arcpy.CreateFileGDB_management("C:/Temp","test") sr = arcpy.SpatialReference("Geocentric Datum of Australia 1994") sr.setFalseOriginAndUnits(-400.0,-400.0,10000000.0) arcpy.CreateFeatureDataset_management("C:/Temp/test.gdb","testFD",sr) arcpy.CreateFeatureclass_management("C:/Temp/test.gdb/testFD","testLines","POLYLINE") cursor = arcpy.da.InsertCursor("C:/Temp/test.gdb/testFD/testLines",["SHAPE@"]) # Tiny line but NOT zero length point = arcpy.Point() array = arcpy.Array() point.X = 153.06436725 point.Y = -27.49210825 array.add(point) point.X = 153.06437825 point.Y = -27.49208025 array.add(point) polyline = arcpy.Polyline(array) cursor.insertRow([polyline]) # Small line point = arcpy.Point() array = arcpy.Array() point.X = 153.0640 point.Y = -27.4920 array.add(point) point.X = 153.0650 point.Y = -27.4930 array.add(point) polyline = arcpy.Polyline(array) cursor.insertRow([polyline]) del cursor with arcpy.da.SearchCursor("C:/Temp/test.gdb/testFD/testLines",["Shape_Length"]) as cursor: for row in cursor: print "Length of line is {0}".format(row[0]) The output that results from the above code is:
>>> Length of line is 0.0 Length of line is 0.00141421356242 >>> 
srto thePolylineconstructor (second parameter), leaving the default spatial reference with a (relatively) large scale units.