[GRASS-dev] Zooming issue in gis manager

Glynn Clements glynn at gclements.plus.com
Wed Nov 1 15:56:34 EST 2006

Maciej Sieczka wrote:

> > This sounds like there is no good reason to set this for interactive zooming
> > by default. If someone wants to use this feature, they could explicitly set
> > it in g.region.
> gis.m zoom tools should preserve the resolution while zooming, and set
> the region extents properly. That's because there are tools in gis.m to
> set WIND to match gis.m display, and to make the display match the
> current region - thus these two operations should not lead to region or
> display settings the user not wanted. The problem is that they do, because:
> 1. If -a is not used in g.region calls in mapcanvas.tcl (like it was
> originally, few months ago), the gis.m zoom tools don't preserve the
> resolution while zooming; and I don't see a reason why the resolution
> should change while zooming, but do I see obvious reason why it
> shouldn't. Thus, I suggested a solution: use the g.region with -a. It
> fixed the resolution issue.

While -a will preserve the resolution, it does more than that. It
doesn't just force the size of the region to be an exact multiple of
the resolution, but also forces its position to be an exact multiple
of the resolution.

> 2. But, now it showed that if g.region -a is used in mapcanvas.tcl, the
> region extent is often not set properly. This is not acceptable either,
> is it?
> Removing the -a flag should fix issue 2, but it will bring the issue 1
> back. What do we do then?

I think that the core problem is that d.rast cannot render an
arbitrary portion of a map; the rendered image has to be aligned to
the cell boundaries.

The region always has an integer number of rows and columns. d.rast
always ensures that the entire region just fits inside the frame; one
pair of edges will always exactly touch the corresponding edges of the

Thus, the rendered image will only ever show whole cells. You will
never get a situation where part of a cell is shown and the other part

At magnifications significantly above unity, this is likely to be
problematic for interactive zooming. You either have to adjust the
bounds so that they aligh with the existing cell grid, or adjust the
resolution so that the cell grid aligns with the bounds.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list