[GRASS-dev] Question on C API and GRASS raster/region

Glynn Clements glynn at gclements.plus.com
Sat Jul 4 10:08:35 PDT 2015


Pietro wrote:

> As you can see the region struct has now 43 rows and 47 columns, but
> still the Rast_window_rows and the Rast_window_cols return still the
> 'old' one.
> The Rast_window_[rows|cols] functions are described in the
> documentation () as "Number of [rows|cols] in active window." with
> active here we mean current, aren't we?
> http://grass.osgeo.org/programming7/raster_2window_8c.html#ac2ce884f9f92cf60e28850c705ba8175
> 
> Therefore why they are not returning 43 and 47?

You need to use Rast_set_window() (or Rast_set_input_window() and/or
Rast_set_ouput_window()) to change the window(s) used by the raster
library.

libgis functions (e.g. G_set_window()) can't do this because libgis is
at a lower level than libraster.

> Creating a new struct and asking for the current region provide me the
> expected result.

Bear in mind that this won't affect the raster I/O functions. The
raster windows are initialised from the libgis window at startup, but
won't change thereafter unless changed via the libraster functions.

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


More information about the grass-dev mailing list