I'm looking to create a new feature class using only selected data from a source feature class. I can get this to work but the ShapeLength field is 0 when I run this script and therefore the feature class has no spatial data. All the other fields are properly filled.
I think I'm missing a step or an array or something but the data is coming right from the source feature class not a list so I don't know how to get it in.
import arcpy, os, zipfile from arcpy import env env.workspace = "Database Connections\\CNTM_MAC_GIS(EPRD-SHS12-LTR,62246).sde" env.overwriteOutput=True # Setting Sources #spatial reference sr1 = "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]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119521E-09;0.001;0.001;IsHighPrecision" BreadSource= "//natn4/NAT_shrdata/MAC/GIS/Data/GPS/Geodatabases/GPS_data.gdb/All_2018_GPS_data" BreadTarget=arcpy.CreateFeatureclass_management(GDBLocation, "GPS_Routes", "POLYLINE", BreadSource, "", "",sr1 ) # set output location dsc = arcpy.Describe(BreadSource) fields = dsc.fields fieldnames = [field.name for field in fields if field.name != dsc.OIDFieldName] #fieldnames = [field.name for field in fields] with arcpy.da.SearchCursor(BreadSource,fieldnames, "Date_dt > date "+ "'" + yyyy + '-' + smm + '-'+ sd + " 00:00:00' AND Date_dt < date "+ "'" + yyyy + '-' + emm + '-'+ ed + " 23:59:59'") as sCur: #add sql where statement to extract subset of data with arcpy.da.InsertCursor(BreadTarget,fieldnames) as iCur: for row in sCur: iCur.insertRow(row) del sCur del iCur