Bug report #14582
The extent of the raster layers is not preserved and rounded to integer with GRASS7 tools in the Processing Toolbox.
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Processing/GRASS | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 22553 |
Description
With QGIS 2.14.0/1... and GRASS 7.0.3 (and GRASS 6.4.4 without problem)
In the calculations made with the "Processing Toolbox > GRASS7 > Raster (r.*)", the raster layer extent is rounded to integer.
So, if i have a dem, the extent before processing can be this:
"Layer Extent (layer original source projection)
358759.5 000000000000000, 6290967.5 000000000000000 : 359280.5 000000000000000, 6291316.5 000000000000000"
and provide, for a processing (r.resample, r.mapcalculator, r. ...) with GRASS7, this result:
"Layer Extent (layer original source projection)
358759.0 000000000000000, 6290967.0 000000000000000 : 359281.0 000000000000000, 6291317.0 000000000000000"
For information: i have choosen to keep the input coordinates with this option: [Leave blank to use min covering extent]
On the contrary, the extent (with decimal) seems to be kept with the same functions under "Processing Toolbox/GRASS6".
Associated revisions
[processing] Don't round grass7 extent and resolution to integer
fix #14582
See: https://hub.qgis.org/issues/14582
The commit removes the a-flag when the grass region for raster analysis is set. The a-flag causes in some cases unwanted rounding of raster extend / resolution, and should not be set hardcoded in processing. It is usually used in combination with the "res" option.
For aligning the pixels of the GRASS region to a specific raster, the align option should be used (and not the a-flag). See: https://grass.osgeo.org/grass70/manuals/g.region.html
GRASS 6.4 algs do not use the a-flag either, which explains why this bug appears only for GRASS 7.
History
#1 Updated by Alexander Bruy over 8 years ago
- Status changed from Open to Feedback
Does it works if you run this command directly in GRASS?
#2 Updated by Giovanni Manghi over 8 years ago
- Affected QGIS version changed from 2.14.0 to master
- Target version deleted (
Future Release - High Priority) - Priority changed from High to Normal
- Status changed from Feedback to Open
apparently in native GRASS there is no rounding in outputs extent.
#3 Updated by Stefan Blumentrath over 8 years ago
Rounding happens because -a flag is given in the g.region command in Grass7Algorithm.py. The -a flag is most useful for rasterizing vector input (e.g. LiDAR point clouds). If you want to align the processing to the cells of an input raster, use the "align" option.
See: https://grass.osgeo.org/grass70/manuals/g.region.html
#4 Updated by Stefan Blumentrath over 8 years ago
See: PR 3090
#5 Updated by Anonymous over 8 years ago
- Status changed from Open to Closed
Fixed in changeset 75c76f51f17d88226fb86826e9aa8c4d96eedb5a.