Before we make these changes, I’d like to reiterate again what is going on with a bit of visual display to better show the issues.
-
There is not a systematic, major inaccuracy from zooming the display in the GIS Manager.
-
This inaccuracy reported only occurs with interactive zooming when displaying a raster map so that the raster grid squares are much larger than the pixel size. That is, when you can see only a few grid squares in the display.
-
It affects the number of grid cells displayed, not the actual computational or display regions.
-
It is primarily (or likely entirely) a function of using g.region -a to align the display region to the raster grid at the current resolution. I originally did NOT use this flag, because I was concerned about potentially uncontrolled changes to zoom precision, but added this to the zooming a few months back at the request of others.
Please note the screen shots links below to help document this issue. These pretty much reconstruct the original steps to show the problem, but without region alignment.
First, I took out the -a switch from the g.region command in mapcanvas.tcl
Then I interactively zoomed (zoom box) the spearfish erosion map to show 7 rows by 13 columns
This is shown in http://www.public.asu.edu/~cmbarton/files/grass_screenshots/display1.jpg
I then selected “save current region to match display” to make the WIND file match the display region set interactively with the zoom.
I next selected “display region settings” from the menu
This can be seen in http://www.public.asu.edu/~cmbarton/files/grass_screenshots/output.jpg
Next, I switched to query mode and clicked the NW and SE corners of the display
This can also be seen in output.jpg. Note that the xy values match those in the region extents output (within the small error of a mouse click)
Finally, I selected “zoom to current region” to redraw the screen and make the display match the WIND file
This can be seen in http://www.public.asu.edu/~cmbarton/files/grass_screenshots/display2.jpg
Note that display1.jpg and display2.jpg are identical.
The reported problem with displaying grid cells at high magnification is primarily or entirely a function of how g.region -a aligns the region with the raster grid cell boundaries. I don’t know how this works internally and someone with C programming experience will have to deal with it if we want it to work differently
So, what do we want to do? We can either have
- All zooming is aligned with the cell borders, matching the current resolution, with the possible result of a bit of rounding error in the display when zoomed in to a point where the cells are very large compared to pixel size–due to the way that g.region -a works.
OR
- Zooming is NOT aligned with the cell borders and the current resolution. In this case, what you see is very close to the actual region extents when zoomed in to a point where the cells are very large compared to pixel size. This is how I originally had it.
Note that if you are NOT zoomed in to a point where grid cells look very large compared with pixels (i.e., most the the time in most maps), then the displays appear identical whether the region is aligned to the cell borders or not.
We cannot have it both ways given how g.region -a works. That is, the underlying zoom math is correct and the same in both cases, but can either zoom with g.region -a or with g.region (without the -a flag).
Michael
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
From: Hamish hamish_nospam@yahoo.com
Date: Tue, 31 Oct 2006 15:13:43 +1300
To: Maciej Sieczka tutey@o2.pl
Cc: mlennert@club.worldonline.be, michael.barton@asu.edu,
grass-dev@grass.itc.it
Subject: Re: [GRASS-dev] d.m/d.gis mysteries…Maciej Sieczka wrote:
I, personally, would even prefer d.m as the default GUI back,
with a mind to making long term users happy, and making the wxpython
development easier, I’d like to extend the GRASS_GUI variable.currently it is both a startup shell variable and a GRASS gisenv
variable. (if it exists, the former sets the latter at startup)currently you can do
GRASS_GUI=text grass63
or
grass63 -textto start with the command line one
GRASS_GUI=tcltk grass63
or
grass63 -gui
or
grass63 -tcltkto start with the Tcl/Tk startup + gis.m
with this patch you can also do
grass63 -oldgui # for d.m
or
GRASS_GUI=d.m grass63
or
GRASS_GUI=gis.m grass63
or even
rename it to whatever the wxpython GUI will be called
GRASS_GUI=wxpython grass63
when wx becomes the default just switch “grass63 -gui” to that target.
grass remembers the last one you used and uses that as the default.
WRT, d.zoom & gis.m zooming- the x monitors and d.zoom have had more
than a decade of heavy use to become mature. gis.m has had barely 9
months of developer testing to become mature. And even then, most of the
long-time developers who hold the bulk of the “institutional knowledge”
only work from the command line… it is really great that it has come
so far so fast.the zooming stuff is tricky business- even after all this time d.zoom
still has some problems and is far from elegant. accurate rendering &
point placement is the bread and butter of a GIS though, so it’d be nice
to have everyone happy with gis.m in the long term. Folks will be
picking points off the screen and writing down coordinates for their
field sites. All the time spent now perfecting the design choices will
pay off well, I am sure. Even if only for when we do the wxPython
version we can pick the best choices the first time.choices are good,
Hamish
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton