Luke -- arcgisscripting is still there under arcpy. (You probably know this by know as this post was 2011!)
So this works (for now anyway).
import arcpy arcpy.env.scratchWorkspace = r"D:\Users\cprice\work" arcpy.CheckOutExtension("spatial") arcpy.env.extent = arcpy.Extent(0, 0, 10, 10) arcpy.env.cellSize = 1 arcpy.gp.SingleOutputMapAlgebra_sa("$$ROWMAP"), "rowmap")
The best workaround I found in that environment was to compute flow accumulations for constant direction grids (and unit weights): $$ColMap is the flow accumulation of a grid filled with 1's and $$RowMap is the flow accumulation of a grid filled with 4's.
I did an implementation of this idea in arcpy map algebra here:arcpy map algebra $$ROWMAP, $$COLMAP
import arcgisscripting gp = arcgisscripting.create(9.3) #This works in ArcGIS 10!!! expr=gp.getparameterastext(0) output=gp.getparameterastext(1) result=gp.SingleOutputMapAlgebra(expr,output)
import numpy as np import arcpy #source http://forums.arcgis.com/threads/865-quot-built-in-quot-rasters-in-python-map-algebra #with some fiddling # Setup some rasters of rows and columns # (like old $$ROWMAP and $$COLMAP) arcpy.env.workspace = "c:/temp" arcpy.env.overwriteOutput = 1 nprows = np.indices((10,10))[0] npcols = np.indices((10,10))[1] # Convert the numpy arrays to ESRI rasters (ie Raster objects) # called 'rows' and 'cols' row_ras = arcpy.NumPyArrayToRaster(nprows) row_ras.save("rowraster") col_ras = arcpy.NumPyArrayToRaster(npcols) col_ras.save("colraster") print row_ras print col_ras
One has to go the numpy route?
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.