[GRASS-dev] wxGUI: align to resolution by default

Hi all,

I added in r70243 new option to the settings "Align region to
resolution" to enable -a flag when setting computation region. I
suggest to enable this option by the default. Let's say that user sets
computation region based on raster and vector map together. He/she
would assume that region grid will be snapped to region grid.

What do you think? Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Wed, Jan 4, 2017 at 8:16 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi all,

I added in r70243 new option to the settings "Align region to
resolution" to enable -a flag when setting computation region. I
suggest to enable this option by the default. Let's say that user sets
computation region based on raster and vector map together. He/she
would assume that region grid will be snapped to region grid.

What do you think? Ma

I agree, it might be good to set it by default.

Anna

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

W dniu 04.01.2017 o 16:03, Anna Petrášová pisze:

On Wed, Jan 4, 2017 at 8:16 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi all,

I added in r70243 new option to the settings "Align region to
resolution" to enable -a flag when setting computation region. I
suggest to enable this option by the default. Let's say that user sets
computation region based on raster and vector map together. He/she
would assume that region grid will be snapped to region grid.

What do you think? Ma

I agree, it might be good to set it by default.

I pretty much always use `-a' with `g.region' in CLI, so personally I
would like such default in GUI.

But maybe there is a good reason why `g.region' doesn't set `-a' by
default, and, by analogy, why GUI should not enforce it either?

Maciek

--
Maciej Sieczka
http://www.sieczka.org

On January 4, 2017 14:16:30 Martin Landa <landa.martin@gmail.com> wrote:

Hi all,

I added in r70243 new option to the settings "Align region to
resolution" to enable -a flag when setting computation region. I
suggest to enable this option by the default. Let's say that user sets
computation region based on raster and vector map together. He/she
would assume that region grid will be snapped to region grid.

What do you think? Ma

Yes, good idea

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Le 4 janvier 2017 14:16:25 GMT+01:00, Martin Landa <landa.martin@gmail.com> a écrit :

Hi all,

I added in r70243 new option to the settings "Align region to
resolution" to enable -a flag when setting computation region. I
suggest to enable this option by the default. Let's say that user sets
computation region based on raster and vector map together. He/she
would assume that region grid will be snapped to region grid.

What do you think? Ma

See the arguments at
https://trac.osgeo.org/grass/ticket/1745

Moritz

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hi,

2017-01-05 8:30 GMT+01:00 Moritz Lennert <mlennert@club.worldonline.be>:

What do you think? Ma

See the arguments at
https://trac.osgeo.org/grass/ticket/1745

hm, I found two reasons there:

1) Using '-a' breaks that by rounding - not surprissing
2) by default GRASS should try to do the least-damaging thing

Well I used -a flag everytime when setting up region based on vector
and raster data. I still think that it could be default in wxGUI. In
99% you want to preserve resolution. Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi,

Actually, I would have no strong opinions about this. However, I am a bit confused...

Cause I almost never use the a-flag.

In fact I use the a-flag only when I want to interpolate e.g. LiDAR point clouds to a new raster with a nice resolution. In all other cases I use the align option, when I want my data to match with the resolution of an existing raster (most of the time a terrain model).

So, when I want to grab the extend from a vector map but want to keep the pixels from my DEM I do:
g.region -p vector=vect_map align=rast_map

For a reported Processing bug in QGIS I even suggested to drop the usage of the a-flag (which Processing used as a default): https://hub.qgis.org/issues/14582
So now I am a bit unsure if my suggestion for Processing bug #14582 was correct... I still think dropping the a-flag was correct for the processing use case ...

Finally, I had a look into the g.region manual and was surprised to see that there is neither an example using the a-flag nor the align option. Would be probably worth adding this. If you agree I can come up with suggestions...

And probably also the description of the a flag could be slightly reworded into e.g.:
"Adjust region extent to be a multiple of the resolution (default = align to bounds, works only for 2D resolution)" (which was: "Align region to resolution (default = align to bounds, works only for 2D resolution)").

Cheers
Stefan

-----Original Message-----
From: grass-dev [mailto:grass-dev-bounces@lists.osgeo.org] On Behalf Of Martin Landa
Sent: torsdag 5. januar 2017 11.05
To: Moritz Lennert <mlennert@club.worldonline.be>
Cc: GRASS developers list <grass-dev@lists.osgeo.org>
Subject: Re: [GRASS-dev] wxGUI: align to resolution by default

Hi,

2017-01-05 8:30 GMT+01:00 Moritz Lennert <mlennert@club.worldonline.be>:

What do you think? Ma

See the arguments at
https://trac.osgeo.org/grass/ticket/1745

hm, I found two reasons there:

1) Using '-a' breaks that by rounding - not surprissing
2) by default GRASS should try to do the least-damaging thing

Well I used -a flag everytime when setting up region based on vector and raster data. I still think that it could be default in wxGUI. In 99% you want to preserve resolution. Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hi,

2017-01-05 11:42 GMT+01:00 Blumentrath, Stefan <Stefan.Blumentrath@nina.no>:

So, when I want to grab the extend from a vector map but want to keep the pixels from my DEM I do:
g.region -p vector=vect_map align=rast_map

hm, you are right. wxGUI could use this command when user sets
computation region based on two map layers (one vector, one raster).
Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Thu, Jan 5, 2017 at 11:04 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2017-01-05 8:30 GMT+01:00 Moritz Lennert <mlennert@club.worldonline.be>:

What do you think? Ma

See the arguments at
https://trac.osgeo.org/grass/ticket/1745

hm, I found two reasons there:

  1. Using ‘-a’ breaks that by rounding - not surprissing
  2. by default GRASS should try to do the least-damaging thing

Well I used -a flag everytime when setting up region based on vector
and raster data. I still think that it could be default in wxGUI. In
99% you want to preserve resolution. Ma

99% I also want to preserve grid geometry and avoid grid shift. A simple example is SRTM. Import an SRTM tile with 3 arcsec resolution, then set the region to the SRTM tile. Now set the region with g.region -a res=00:00:03 and compare the extents. They will be shifted by half a pixel and no longer match the SRTM tile.

I am opting for 2) by default GRASS should try to do the least-damaging thing

Markus M


Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Thu, Jan 5, 2017 at 11:47 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2017-01-05 11:42 GMT+01:00 Blumentrath, Stefan <Stefan.Blumentrath@nina.no>:

So, when I want to grab the extend from a vector map but want to keep the pixels from my DEM I do:
g.region -p vector=vect_map align=rast_map

hm, you are right. wxGUI could use this command when user sets
computation region based on two map layers (one vector, one raster).

The above example does not set the region from two map layers (one vector, one raster), that would be g.region -p vector=vect_map raster=rast_map. Instead, it sets the region extents from a vector and aligns the region to a raster. That is a big difference.

IMHO, the GUI should not try to be too clever about how to adjust the computational region, instead users should be clever about how to adjust the computational region because changed region settings can cause unexpected results.

Markus M

Ma


Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hi,

2017-01-05 22:56 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

The above example does not set the region from two map layers (one vector,
one raster), that would be g.region -p vector=vect_map raster=rast_map.
Instead, it sets the region extents from a vector and aligns the region to a
raster. That is a big difference.

yes, I am saying that this operation is not straightforward in wxGUI,
user need to do several steps

1) set comp region from raster
2) go to settings, enable -a flag\
3) set comp region from vector
4) probably disable -a

IMHO, the GUI should not try to be too clever about how to adjust the
computational region, instead users should be clever about how to adjust the
computational region because changed region settings can cause unexpected
results.

Hm, I added to wxGUI new item to "Set computational region from
selected vector(s) align to raster" (r70276). This is enabled only
when user selects vector(s) and one raster map together. If it make
sense to you I will backport to relbr72.

Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

(attachments)

wxgui-align.png

On Fri, Jan 6, 2017 at 6:26 PM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2017-01-05 22:56 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

The above example does not set the region from two map layers (one vector,
one raster), that would be g.region -p vector=vect_map raster=rast_map.
Instead, it sets the region extents from a vector and aligns the region to a
raster. That is a big difference.

yes, I am saying that this operation is not straightforward in wxGUI,
user need to do several steps

  1. set comp region from raster
  2. go to settings, enable -a flag\
  3. set comp region from vector
  4. probably disable -a

IMHO, the GUI should not try to be too clever about how to adjust the
computational region, instead users should be clever about how to adjust the
computational region because changed region settings can cause unexpected
results.

Hm, I added to wxGUI new item to “Set computational region from
selected vector(s) align to raster” (r70276). This is enabled only
when user selects vector(s) and one raster map together. If it make
sense to you I will backport to relbr72.

How about two items:

  • “Set computational region from selected map(s)” will set the region extents to include all selected maps, irrespective of type.

  • “Align region to selected raster” will align the region to a single selected raster

Just to be safe, I usually do this two-step adjustment: first set the extents, then set and/or align to the resolution.

Markus M

Ma


Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi,

2017-01-11 15:19 GMT+01:00 Markus Metz <markus.metz.giswork@gmail.com>:

How about two items:
- "Set computational region from selected map(s)" will set the region
extents to include all selected maps, irrespective of type.
- "Align region to selected raster" will align the region to a single
selected raster

Just to be safe, I usually do this two-step adjustment: first set the
extents, then set and/or align to the resolution.

good idea, done in r70365. If no objection I would backport it to
relbr72 including -a flag in preferences. Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi,

2017-01-13 21:02 GMT+01:00 Martin Landa <landa.martin@gmail.com>:

good idea, done in r70365. If no objection I would backport it to
relbr72 including -a flag in preferences. Ma

done in r70402. Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa