# Process: Calculate Field gp.CalculateField_management(shpFile_ok, "date", fieldVal, "PYTHON_9.3", "")
#------------------------------------------------------------------------------------------------ #------------------------- script to create features from txt file ------------------------ #------------------------------------------------------------------------------------------------ # Create geoprocessing dispatch object import arcgisscripting, glob gp = arcgisscripting.create() # allow you to access the geoprocessing tools in arcgis #------------------------------------------------------------------------------------------------ try: outdir = "F:\\front\\trash" filePaths = glob.glob("F:\\front\\trash\\*_ok.txt") print filePaths for filePath in filePaths: inTxt = filePath[15:] inSep = "local decimal point" shpFile = filePath[15:-7] + "_ok.shp" #outdir + shpFile_Ok = shpFile fieldVal = shpFile[20:22] + "/" + shpFile[18:20] + "/" + shpFile[14:18] print fieldVal print shpFile print inTxt print 'got to here' # Run tool gp.CreateFeaturesFromTextFile_samples(inTxt, inSep , shpFile, \ "PROJCS['Polar Stereographic', GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984', \ SPHEROID['WGS_1984',6378137.0,298.257223563]], PRIMEM['Greenwich',0.0], \ UNIT['Degree',0.0174532925199433]],PROJECTION['Stereographic_North_Pole'], \ PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-45.0], \ PARAMETER['Standard_Parallel_1',71.0], UNIT['Meter',1.0]] \ ;-30636100 -30636100 147003033.263715;-100000 10000;-100000 10000;0.001;0.001;0.001; IsHighPrecision") print 'Got to there...' # Process: Add Field gp.AddField_management(shpFile, "date", "DATE", "", "", "", "", "NON_NULLABLE", "NON_REQUIRED", "") # Process: Calculate Field gp.CalculateField_management(shpFile_ok, "date", "fieldVal", "PYTHON_9.3", "") except: print gp.GetMessages() # allows to get error message when they happen
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.