You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - Raster display and management forum

cell coordinates   Marcel Houle Feb 16, 2006
Re: cell coordinates   Luke Pinner Feb 19, 2006
Re: cell coordinates   Luke Pinner Feb 19, 2006
Re: cell coordinates   Marcel Houle Feb 20, 2006
Re: cell coordinates   Luke Pinner Feb 20, 2006
Re: cell coordinates   Luke Pinner Mar 08, 2006
Re: cell coordinates   Luke Pinner Jul 27, 2007
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject cell coordinates 
Author Marcel Houle 
Date Feb 16, 2006 
Message In ArcView 9.1, we can display the value and coordinates of a raster cell with the identify button.
Is is possible to get this information within a modeling process run with the Raster Calculator ?
The model will process each input cell and will generate a new raster whose cell value will be a function of input cell coordinates.

Thanks. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: cell coordinates 
Author Luke Pinner 
Date Feb 19, 2006 
Message It _SHOULD_ be simple to do this with the Single Output Map Algebra tool using the built-in grid scalar variables $$XMAP and $$YMAP which return the coordinates of the cell currently being processed. However, built-in scalar vars _DO NOT_ work in the ArcToolbox Spatial Analyst tools, which is a major pain in the proverbial... (Hello ESRI, are you listening? Maybe I should submit an enhancement request...) As a workaround, you can generate grids of these coordinates in the Spatial Analyst Raster Calculator (where the scalars do work!) or Workstation ArcINFO Grid. Either way, don't forget to set your analysis environment using the Spatial Analyst toolbar -> Options -> Working Directory/Extent/Cellsize or GRID commands setwindow & setcell etc... then use the following syntax (in the Raster Calculator or GRID prompt):

xcoords = $$XMAP
ycoords = $$YMAP (don't try and put both statements in a single execution of the raster calculator...)

You will get 2 grids - the value of each cell will be the X or Y coordinate at the centre of that cell. If you want the coordinates of the lower left corner of the cell, simply minus 1/2 the cell size eg. (assuming cellsize = 10)

xcoords = $$XMAP - 5
ycoords = $$YMAP - 5

You can then use these grids in map algebra statements in your ArcToolbox models/scripts 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: cell coordinates 
Author Luke Pinner 
Date Feb 19, 2006 
Message Sorry, just read your post a bit more carefully. It seems you are already using the Raster Calculator, not ArcToolbox, so just use the scalr vars $$XMAP and $$YMAP in your expression whenever you need X & Y coordinates. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: cell coordinates 
Author Marcel Houle 
Date Feb 20, 2006 
Message Thanks.

Where can I find information about these built-in grid scalar variables...I found nothing in the Online or Desktop Help for ArcGIS. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: cell coordinates 
Author Luke Pinner 
Date Feb 20, 2006 
Message I couldn't find anything in ArcGIS Help, below is an extract from ArcINFO Workstation Help (ArcDoc)

GRID provides several scalar variables that reflect the current state of the analysis environment. These built-in variables are maintained and updated automatically by GRID. They can be used in modeling either inside or outside the DOCELL block and in AML. These built-in scalars do not relate to any particular grid, but refer to the analysis environment.

The following is a list of scalar variables available within GRID.

$$NROWS: the number of rows in the analysis window
$$NCOLS: the number of columns in the analysis window
$$CELLSIZE: the current cell size specified in the analysis environment
$$WX0: minimum x-map coordinate of the current analysis window
$$WY0: minimum y-map coordinate of the current analysis window
$$WX1: maximum x-map coordinate of the current analysis window
$$WY1: maximum y-map coordinate of the current analysis window
$$XMAP: x-map coordinate for the center of the processing cell
$$YMAP: y-map coordinate for the center of the processing cell

GRID also provides a set of built-in constants.
PI: 3.142
E: 2.718 (e)
DEG: 57.296 (Degree to radian conversion)
GAMMA: 0.577
PHI: 1.618

GRID also provides two built-in grids.

$$ROWMAP
$$COLMAP

The $$ROWMAP and $$COLMAP are grids that can be used in operators and functions but also can be used to identify row and column locations. The $$ROWMAP grid assigns 0 to all the cells in the first row, 1 to the values in the second row, and so forth. The $$COLMAP grid assigns 0 to the cells in the first column, 1 to the cells in the second column, and so forth. The size of the grids is derived from the current window and cell size set for the analysis window. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: cell coordinates 
Author Luke Pinner 
Date Mar 08, 2006 
Message For info - response from ESRI to a tech support request re built-in scalars and constants in the ArcToolbox GeoProcessing framework:

"Sorry it took awhile to get back to you. I was waiting on a response from one of the Spatial Analyst Product Specialist. The behavior you have described is definitely not a bug. The geoprocessing environment does not allow for the use of GRID variables/scalars. Based on the feedback I received, an enhancement request is not likely to change the current design. However, if your client insists on one I will log it for them." 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: cell coordinates 
Author Luke Pinner 
Date Jul 27, 2007 
Message Update: at 9.2 ArcToolbox spatial analyst Map Algebra tools accept scalar vars, constants and built in grids (note have not tested all of 'em)