[GRASS-user] about r.region...

Glynn Clements glynn at gclements.plus.com
Wed Apr 4 14:51:53 EDT 2007


Ricardo Oliveira wrote:

> Maybe i am doing something wrong, but when importing a map, the
> resolution of the output image is not the correct one, meaning the
> one from the image.
> 
> For instance: i create a region, with g.region, to match the data of
> my image:
> 
> north:      4.1585
> south:      0
> east:       2.4845
> west:       0
> cols:       1553
> rows:       2599
> e-w resol:  0.00159981
> n-s resol:  0.00160004
> 
> BUT after r.in.gdal the image is huge, and does not match it`s
> position (although the 0,0 corner of the image is correct). So i
> need to use r.region to reposition it.

The current region doesn't have any effect upon import operations. 
Unless the image is georeferenced (e.g. GeoTIFF), the lower-left
corner will be at (0,0), the resolution will be one unit (metre, foot)
per cell, and the number of rows and columns will match those of the
image.

> From the r.region man page: 
> "After all updates have been applied, the raster map's resolution
> settings are recomputed from the boundaries and the number of rows
> and columns in the raster map."
> 
> My question is: what is the method for this "recompute" operation?

Divide the extent by the number of cells, i.e.:

	e-w resol = (east - west) / cols
	n-s resol = (north - south) / rows

> Do i really need to use r.region?

Yes.

> And if so what is the method for
> (^) the recompute operation? Nearest neighbor resample?

r.region modifies the cellhd file; it doesn't modify the data. It just
sets the bounds, and recomputes the n-s and e-w resolutions.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list