import arcpy, os arcpy.env.overwriteOutput = True #list of lists with values [X, Y, InterpolationValue] valLst = [ [20.0, 50.0, 345], [20.0, 51.0, 346], [20.5, 50.5, 347] ] #set up spatial reference and names prjFile = os.path.join(arcpy.GetInstallInfo()["InstallDir"], r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj") spatialRef = arcpy.SpatialReference(prjFile) tempWorkspace = "in_memory" outXYfc = "XY_FeatureClass" #create in_memory empty feature class arcpy.CreateFeatureclass_management(tempWorkspace, outXYfc , "POINT", "","","", spatialRef) #build temp FC path and add new field for values to interpolate tempFC = os.path.join(tempWorkspace, outXYfc) arcpy.AddField_management(tempFC, "InterpVal", "DOUBLE") #create insert cursor inCur = arcpy.InsertCursor(tempFC) #loop through main list, add values to cursor row and insert row for element in valLst: pnt = arcpy.Point(element[0], element[1]) row = inCur.newRow() row.Shape = pnt row.InterpVal = element[2] inCur.insertRow(row) del inCur, row #FOR TESTING: test if temporary feature class is OK #arcpy.CopyFeatures_management(tempFC, r"C:\tmp\Test.gdb\XYpoints")
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.