print 'Creating Text File...' text = open(p.join(ws, "Addresses2.txt"), "w") text.writelines('"Parcel_ID"\t"FULL_ADD"\t"POINT_X"\t"POINT_Y"') srows = arcpy.SearchCursor(address) for row in srows: pid = row.getValue('PID') add = row.getValue('FULL_ADD') x = row.getValue('POINT_X') y = row.getValue('POINT_Y') text.writelines('\n"%s"\t"%s"\t%f\t%f' % (pid,add,x,y)) text.close() del row, srows print 'Text File Created Successfully'
import arcpy, os, sys, traceback arcpy.env.workspace = 'G:\\Data\\Geodatabase\\Cedar_County.mdb' arcpy.env.overwriteOutput = True infeat = 'G:\\Data\\Geodatabase\\Cedar_County.mdb\\SOILS\\SOILS_BY_PARCEL' outputpath = 'O:\\CSR_Report\\' dissolveoutpath = 'G:\\PROJECTS\\Cedar\\Soils\\testing\\' outfeat = dissolveoutpath + 'dissolve.shp' out_table = outputpath + 'CSR_Report.csv' dfield = "PID" statfield = "WEIGHTED_AVERAGE_CSR FIRST; SUM_ FIRST" dfield = ['PID'] expression = "!FIRST_WEIG!" expression2 = "!FIRST_SUM_!" dropfields = ["FIRST_WEIG", "FIRST_SUM_"] try: print "Starting Dissolve..." arcpy.Dissolve_management(infeat, outfeat, dfield, statfield, "MULTI_PART", "DISSOLVE_LINES") arcpy.AddField_management(outfeat, "AVE_CSR", "FLOAT") arcpy.CalculateField_management(outfeat, "AVE_CSR", expression, "PYTHON") arcpy.AddField_management(outfeat, "TOTAL_CSR", "FLOAT") arcpy.CalculateField_management(outfeat, "TOTAL_CSR", expression2, "PYTHON") print 'Cleaning table' arcpy.DeleteField_management(outfeat, dropfields) print 'Dissolve finished, now converting table to CSV' fieldnames = [f.name for f in arcpy.ListFields(outfeat)] arcpy.ExportXYv_stats(outfeat, fieldnames, "COMMA", out_table, "ADD_FIELD_NAMES") print 'CSR table created sucessfully' except: arcpy.AddError(arcpy.GetMessages(2))
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.