Knowledge Base - Technical Articles


Technical Article   HowTo:  Locate the column and row of a point within a raster

Article ID: 38007
Software:  ArcGIS - ArcEditor 9.3, 9.3.1, 10 ArcGIS - ArcInfo 9.3, 9.3.1, 10 ArcGIS - ArcView 9.3, 9.3.1, 10
Platforms: N/A

Summary

Instructions provided describe how to locate the exact pixel location (column and row) of a point within a raster.

Procedure

Locating the exact pixel location (column and row) of a point within a raster can be done one of two ways: the first uses the Field Calculator in the attribute table of the point feature class, and the second utilizes Spatial Analyst.

To use the Field Calculator in the attribute of the point feature class, follow the steps below.

1. Create two fields in the attribute table, using type Long Integer.

2. Right-click on each field and select the Field Calculator.

3. Enter the following equation:

Field1:

Int(Abs((X - [X] ) / Z) + 1)

Field2:

Int(Abs((Y - [Y] ) / Z) + 1)

Where X and Y are the starting X/Y location of the raster, [X] and [Y] are the X/Y location of the point, and Z is the pixel size.

For Example:

Int(Abs ((-80 - [X] ) / .00083333333) + 1)
Int(Abs ((35 - [Y] ) / .00083333333) + 1)

Where -80 and 35 are the starting X/Y location of the raster, [X] and [Y] are the X/Y location of the point, and .00083333333 is the pixel size.

To utilize Spatial Analyst, follow the steps below.

1. Open Single Output Map Algebra tool in Spatial Analyst tools > Map Algebra.
2. Type $$rowmap + 1 in the Map Algebra Expression window.
3. Click the Environments button and set the environments for extent and cellsize to that of the original raster.
4. Change the name of the output to Rows.
5. Click OK and let the tool run.

1. Open Single Output Map Algebra tool in Spatial Analyst tools > Map Algebra.
2. Type $$colmap + 1 in the Map Algebra Expression window.
3. Click the Environments button and set the environments for extent and cellsize to that of the original raster.
4. Change the name of the output to Columns.
5. Click OK and let the tool run.

1. Open the Sample tool found in Spatial Analyst Tools > Extraction.
2. Select the two rasters that were created (Rows and Columns).
3. Select the point inputs.
4. Click OK and let the tool run.



Created: 7/8/2010
Last Modified: 11/9/2011

If you would like to post a comment, please login