[GRASS5] [bug #3296] (grass) i.rectify: automatic resolution
calculation is wrong
Hamish
hamish_nospam at yahoo.com
Tue May 31 02:41:06 EDT 2005
> this bug's URL: http://intevation.de/rt/webrt?serial_num=3296
> ---------------------------------------------------------------
>
> Subject: i.rectify: automatic resolution calculation is wrong
..
> imagery/i.rectify/get_wind.c
>
> [w1 is starting window, w2 is target window]
>
> w2->ns_res = (w2->north - w2->south) / w1->rows;
> w2->ew_res = (w2->east - w2->west ) / w1->cols;
>
>
> Say you have a map which is much taller than it is wide and after
> rectification it will be rotated 90 degrees to be very wide but not
> very tall. The above code will leave the resultant map with many
> divisions in the vertical, and few in the horizontal, ruining the data
> quality. The effect is less and less obvious as the rotation nears 0
> or 180 degrees.
Attached is an image to help visualize the situation. **Dimension numbers
are number of rows/columns, not anything to do with map units.**
Proposed solution:
get_wind.c currently calculates the coordinates of the four target
corners to do the target region setting. We can hold on to these and
a., calculate the resolution from the projected width of base, not
overall region width; height from projected height of side, not height
of region. and b., figure out the angle, if >45deg (& <135, etc) swap
rows for columns (or nsres for ewres) in the calculation.
Problems with proposed solution:
1) corner coordinate calculations are currently a bit flaky for lower
orders, and outright wrong for order=3. (CRS_georef() in i.rectify/crs.c)
2) flip rows for columns when theta > 45deg is fine on paper, but what
if the target location is lat/lon? a., how to know that? b., what trig
to apply to know where the tipping point is?
3) order=3 allows stretching of the image, how to compensate for that?!
res= res at smallest corner?
any ideas?
Hamish
-------------- next part --------------
A non-text attachment was scrubbed...
Name: irect_resolution.png
Type: image/png
Size: 22424 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20050531/3d3b4e7d/irect_resolution.png
More information about the grass-dev
mailing list