[GRASS-dev] pygrass.gis.Region API explanations

Markus Neteler neteler at osgeo.org
Sat Apr 27 09:13:02 PDT 2019


Hi Panos,

On Sat, Apr 27, 2019 at 5:30 PM Panagiotis Mavrogiorgos
<pmav99 at gmail.com> wrote:
>
> Hello all,
>
> I am trying to use the pygrass API to create a contextmanager that set's a temporary Region, but I am not sure which method I should be using. The following methods seem to be relevant:
>
> Region.set_current()
> Region.set_raster_region()
> Region.write()
>
>
> Could someone further clarify when each one should be used?

Here is some sample code:
https://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library#Using_temporary_region_for_computations

which makes use of script.core.use_temp_region()
https://grass.osgeo.org/grass77/manuals/libpython/script.html#script.core.use_temp_region

Others here may be able to suggest what's recommended.

Best,

Markus


More information about the grass-dev mailing list