[GRASS5] problems with [rsv].proj

Morten Hulden morten at ngb.se
Wed May 29 07:55:47 EDT 2002


On Wed, 29 May 2002, Glynn Clements wrote:

> When computing the region of interest, cells which fail to project
> should just be ignored. When performing the actual projection, cells
> which fail to project should be NULL.

Should be fairly easy to fix: Find the places in the code where 
[src].proj exits with 'Error in do_proj' and change action according to 
above.

(I don't have a GRASS installation to work with right now, but maybe 
someone else is willing to take on this task)

> Also, I've remembered another issue with r.proj:
> 
> When projecting lat/lon to pseudo-cylindrical projections where the
> entire globe fits within the region, the resulting map tends to
> "wrap"; i.e. the area outside of the "ellipse" contains non-null
> cells.

Can you confirm this happens with recent versions of proj 
(post-December-2001).

The way r.proj works (omitting here the initial testing/trimming 
done in bordwalk.c) is:

For each cell in the destination region
	-project the cell center into source map 
	-find the category value of the nearest cell 
		(alternatively using cubic etc interpolation)
	-assign that value to the cell in the destination region

For a pseudo-cylindrical destination there will a number of cells outside 
the ellipse that should become NULL. (The real 'borders' in this case is 
actually the ellipse, not the window borders given in DEFAULT_WIND). 
Projecting a co-ordinate outside the ellipse should result in proj 
returning * (inf?) for either lon or lat or both.

The fix would be to look up the place in the code where r.proj checks the
return values from proj and if either lat or lon is invalid, assign the
destination cell a NULL value without even trying to find the category
value of the nearest cell in the source map.

I faintly remember r.proj already does something like this, although the
checks may be incomplete (maybe it's only checking for NULL cells in the
source map), but not having the code right now it is impossible for me to
say.

Morten Hulden





More information about the grass-dev mailing list