internal grids rowmap/colmap/xmap/ymap

12-03-2010 03:24 AM
Occasional Contributor

What is the latest on internal $$RowMap etc grids in ArcGIS 10? One has to go the numpy route?
0 Kudos
6 Replies
New Contributor III
One has to go the numpy route?

Unfortunately, that seems to be the only solution for now. You might want to add your voice to the ArcGIS "wish list" at An arc grid request has already been created. Click here for a direct link.
0 Kudos
Occasional Contributor
Thanks for the link - I have voted it up!
0 Kudos
MVP Esteemed Contributor
From this thread, in version 10
try the example

import numpy as np
import arcpy
#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)"rowraster")
col_ras = arcpy.NumPyArrayToRaster(npcols)"colraster")
print row_ras
print col_ras
0 Kudos
MVP Regular Contributor
I found I can use the built in GRID variables or scalars in ArcGIS 10 with a bit of a hack.  It appears that the python arcgisscripting module is still included in Desktop ArcGIS 10, perhaps for backwards compatibility (or perhaps I didn't uninstall 9.3 properly...), so I wrote a little script that uses the SingleOutputMapAlgebra tool, created a script tool and added that to a custom toolbox and then just use that as required.

import arcgisscripting
gp = arcgisscripting.create(9.3) #This works in ArcGIS 10!!!

I've attached a screenshot.
MVP Esteemed Contributor

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.env.extent = arcpy.Extent(0, 0, 10, 10)

arcpy.env.cellSize = 1"$$ROWMAP"), "rowmap")

MVP Esteemed Contributor
   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