Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How can I get the real coordinates (i.e. X and Y) of a given grid cell when I know its row and column position? Thanks Demetris

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

If you know row, column, cellsize and extent, X & Y can easily be calculated. Note this assumes a North up raster. If the raster is rotated you'll need to know the other two affine transformation coefficients (or geotransform in GDAL speak). Also note that the column/row coordinates in the below are from (0.0,0.0) at the upper left corner of the upper left pixel. To get the coordinates of the centre of the column/row location you need to add 0.5 to the column and row values.

mapx = xmin + col*cellsize
mapy = ymax - row*cellsize

See also the IRaster2.PixelToMap Method (9.3 reference and 10 reference)

share|improve this answer
    
Luke:How can I determine the Xmin and Ymax in the above formulas? –  Demetris Dec 5 '11 at 5:37
    
I've updated my answer to add links to the IRaster2.PixelToMap method. –  Luke Dec 5 '11 at 11:47
    
Ok Luke. Many thanks. This is the right answer. –  Demetris Dec 5 '11 at 15:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.