[GRASS-dev] Change the resolution in the output map

Glynn Clements glynn at gclements.plus.com
Fri Nov 30 23:36:48 EST 2007


Juan Diego Giraldo Osorio wrote:

> I'm working with grass62. I'm triying to create a raster map with finer
> resolution from another with coarse resolution. The problem is the next:
> 
> - My coarse resolution map (input map) have 500 m of resolution, with
> 1000x1000 rows*cols. This information is the same as the current region.
> - I want to create a finer resolution map (output map) with 100 m of
> resolution, with 5000x5000 rows*cols.
> - I have been trying with the next code:
> 
> 	/* Adjust the region to new resolution */
> 	region.rows = nsubpixel*nrows;
> 	region.cols = nsubpixel*ncols;
> 	region.format = 0;
> 	region.compressed = 1;
> 	G_adjust_Cell_head( &region , 1 , 1 );
> 	G_set_window(&region);
> 
>   nsubpixel is 5 (500/100), and I'm writing a new header file with this
> new information (region.rows=5000, region.cols=5000, region.ew_res=100,
> region.ns_res=100) but when I read the new map, the next message error
> is shows:
> 
>   WARNING: error reading null row 115
>   ... a lot of times.

If you want to work with different resolutions, you need to
continually switch between the two. Opening and reading the input map
must be done with the source region active, while opening, reading and
closing the output map must be done with the destination region
active.

See the r.resamp.interp and r.resamp.stats modules for examples.

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


More information about the grass-dev mailing list