Please let me show you some tests on very small rasters and resolution
changes:
case 1:
resolution 500:
10 15 20 25
30 35 40 45
50 55 60 65
changing resolution to 1000 results in:
15 25
55 65
and real resolution ew=1000 and ns=750
the kept points are the upper right of a four group
case 2:
resolution 500:
10 15 20
30 35 40
50 55 60
changing resolution to 1000 results in:
10 20
50 60
and real resolution ew=750 and ns=750
the choosen points are the ones in the corners of the whole thing
Who decides the values of the new resolutions, the number of cells to use and
the values of the map to keep?
Cheers
Andrea
--
____________________________________________________________________________
University of Trento
Department of Civil and Environmental Engineering
Via Mesiano, 77 - Trento (ITALY)
Andrea Antonello
tel: +393288497722
fax: +390461882672
____________________________________________________________________________
Andrea Antonello wrote:
Who decides the values of the new resolutions, the number of cells to use and
the values of the map to keep?
First, when you change the resolution, the new resolution will be
adjusted so that the number of rows and columns are both integers.
I.e. (north - south) will be an exact multiple of ns_res (or as close
as can be represented using floating point), and similarly for the
horizontal dimensions.
When you request a given cell, the coordinates of the cell's centre
are computed from the row/column indices and the current region's
boundaries and resolution:
northing = north - (row + 0.5) * ns_res
easting = west + (col + 0.5) * ew_res
The cell indices in the original map are then computed from the above
along with the boundaries and resolution of the original map:
row = round((north - northing) / ns_res)
col = round((easting - west ) / ew_res)
Note: the above is pseudo-code. The actual code used is in
src/libes/gis/window_map.c. The column->column mapping is cached in
the col_map field of each map's fileinfo structure, while the row->row
mapping is computed when the row is read.
Also, note that your first example is unstable. If you multiply the
resolution by an even number, the centre of each region cell will fall
on the boundary between cells in the original map, so even the tiniest
rounding error can affect which cell is actually chosen.
--
Glynn Clements <glynn.clements@virgin.net>