[GRASSLIST:2157] Re: Where's the data within a cell?

Frank Warmerdam warmerdam at pobox.com
Wed Jul 25 20:53:22 EDT 2001

Rich Shepard wrote:
> On Wed, 25 Jul 2001, Roger Miller wrote:
> > The location produced by d.what.rast is the cell center.  The location
> > produced be d.where is something more like the pixel location.  The
> > coordinates bounding a region covered by a raster map are the coordinates
> > at the outside edge of the bounding row or column of the raster map.
> Roger,
>   Thank you, that's very good to know. I wonder where the point is for USGS
> DEMs imported via r.in.gdal. Perhaps Frank will answer this for us, or I
> need to dig into the SDTS DEM metadata and see if it's defined there
> somewhere.


GDAL takes the position that the data for a cell (aka pixel) is representative
of the area of the cell.  The origin of raster (top left corner) coordinate
is the top left corner of the top left pixel.  

In GRASS the edges of a raster map are the outer edges of the edge pixels
(same as GDAL).   

GDAL remaps coordinates appropriate when reading from formats where the
origin is the center of the top left pixel or any other arrangement for
that matter, such as is the case with Erdas Imagine format for instance. 

As Roger implicitly shows the better question is how do particular tools
report the position of a given pixel, and it appears to typically be the
center of the pixel/cell. 

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the grass-user mailing list