[Qgis-developer] Problem with GRASS Region Extent and Region Cellsize on Processing

Blumentrath, Stefan Stefan.Blumentrath at nina.no
Sun Mar 13 13:04:16 PDT 2016


Hi,

GRASS adjusts the resolution to the bounds (extent) you specified, either as n, s, e, w coordinates (like in Processing) or using the “vector” or “raster” option. This can conflicting with information provided through the user specified resolution; meaning that either bounds or resolution has to be adjusted. By default priority is given to the bounds (and resolution is adjusted if necessary) in GRASS, while setting the a-flag gives priority to the resolution (and bounds are adjusted).

However, if one wants to align the cells with a specific raster map, the “align” option should be used where only the resolution and placement of the cells (not the extent) is picked from the provided raster map. See: https://grass.osgeo.org/grass70/manuals/g.region.html

Personally, I would say the “align” option (e.g. as “align to input”) is more suitable for modules like r.aspect (and the resolution option could be removed) ...
Specifying a resolution can make sense for modules like v.to.rast. However also here alignment with a specific raster (e.g. a DEM might be even more desirable).

There was another thing in Grass7Algorithm.py that surprised me: The use of r.out.gdal.
Using r.external.out befor running the algorithm, should be able to save you one read- and write step: https://grass.osgeo.org/grass70/manuals/r.external.out.html
Was it not applicable in Processing?

Cheers
Stefan



From: Pedro Venâncio [mailto:pedrongvenancio at gmail.com]
Sent: 13. mars 2016 17:47
To: Blumentrath, Stefan <Stefan.Blumentrath at nina.no>
Cc: gene <martin.laloux at gmail.com>; qgis-developer at lists.osgeo.org
Subject: Re: [Qgis-developer] Problem with GRASS Region Extent and Region Cellsize on Processing

Hi Martin and Stefan,

I understand, if we do not use the -a flag, we can not ensure that the resolution is the set.

What if there is another option, "align=", as Stefan suggested, which allows to choose a raster from the canvas? This would ensure that the region would be aligned with a selected raster?
Thank you very much!
Pedro



2016-03-12 10:44 GMT+00:00 Blumentrath, Stefan <Stefan.Blumentrath at nina.no<mailto:Stefan.Blumentrath at nina.no>>:

________________________________________
Von: Qgis-developer [qgis-developer-bounces at lists.osgeo.org<mailto:qgis-developer-bounces at lists.osgeo.org>] im Auftrag von gene [martin.laloux at gmail.com<mailto:martin.laloux at gmail.com>]
Gesendet: Samstag, 12. März 2016 10:46
An: qgis-developer at lists.osgeo.org<mailto:qgis-developer at lists.osgeo.org>
Betreff: Re: [Qgis-developer] Problem with GRASS Region Extent and Region Cellsize on Processing

To keep the raster resolution.

In the book "OPEN SOURCE GIS A GRASS GIS Approach Third Edition",   p.57

"It may happen, that region boundaries lead to a modified, non-integer
raster resolution. If this is not desired, the -a flag can be used to align
the region to resolution. It adjusts all four boundaries to be even
multiples of the resolution by slightly enlarging the current region. To see
the effect, compare:
g.region res=15 -dp
g.region res=15 -adp"

Look also:

-  suggestion for g.region -a
<http://osgeo-org.1560.x6.nabble.com/suggestion-for-g-region-a-td4014517.html>
(Michael Barton)

"Currently, if you use the -a flag with g.region it will align the region
exactly to match the resolution of a map (e.g. g.region -a rast=myrast will
set the region to exactly the resolution of myrast regardless of the
extents) or the resolution specified in the res or ewres/nwres fields (e.g.
g.region -a n=523 s=15 res=10 will adjust the extents a little to make sure
the resolution is exactly 10)"

- or in  proposal: make -a flag the default behaviour for g.region
<https://trac.osgeo.org/grass/ticket/1745>  (Moritz Lennert)

"In my experience, when working with raster, having a precise resolution is
the most important issue, while exact extension is less important. I often
use existing vector data or bounds coordinates to determine the extent, but
then have to use the -a flag to make sure that the desired resolution is
kept.
I would like to propose that in grass7, the behaviour is switched, i.e. to
make the -a flag (Align region to resolution) the default behaviour, and
"align to bounds" the option"


I guess it depends a bit what the most suitable solution is... There is also the "align" option which aligns the resolution to an input raster. Personally, i only use tha a-flag only in combination with the res option...
Cheers,
Stefan





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-with-GRASS-Region-Extent-and-Region-Cellsize-on-Processing-tp5255693p5255960.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org<mailto:Qgis-developer at lists.osgeo.org>
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org<mailto:Qgis-developer at lists.osgeo.org>
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160313/79c04913/attachment-0001.html>


More information about the Qgis-developer mailing list