f = 'D:\\temp\\test.txt' with open(f, 'w') as fObj: fObj.write('x, y, z\n') for i in range(10): fObj.write('%f, %f, %f\n % (i, i, i))
outTxt = 'D:\\temp\\test.txt' inRasFP = 'D:\\temp\\raster.img' inRas = arcpy.Raster(inRasFP) extent = inRas.extent with open(outTxt, 'w') as fObj: fObj.write('x, y, z\n') # only if you want a header in the text file for x in range(extent.XMin, extent.XMax): for y in range(extent.YMin, extent.YMax): fObj.write('%i, %i, %f\n % (x, y, arcpy.GetCellValue_management(inRasFP, "%i %i" % (x, y))))
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.