[GRASS5] problems with [rsv].proj

Morten Hulden morten at ngb.se
Thu Jun 6 20:39:28 EDT 2002


On Thu, 30 May 2002, Glynn Clements wrote:

> The following patch produces the "desired" result (i.e. the way that
> pseudo-cylindrical world maps normally look in illustrations), but is it
> the right thing to do?
> 
> diff -u -r1.2 PJ_urmfps.c
> --- src/libes/proj/PJ_urmfps.c	20 Apr 2002 19:13:44 -0000	1.2
> +++ src/libes/proj/PJ_urmfps.c	30 May 2002 04:30:08 -0000
> @@ -17,8 +17,12 @@
>  }
>  INVERSE(s_inverse); /* sphere */
>  	xy.y /= P->C_y;
> +	if (fabs(xy.y) > HALFPI)
> +		I_ERROR
>  	lp.phi = aasin(sin(xy.y) / P->n);
>  	lp.lam = xy.x / (C_x * cos(xy.y));
> +	if (fabs(lp.lam) > PI)
> +		I_ERROR
>  	return (lp);
>  }
>  FREEUP; if (P) pj_dalloc(P); }
> 
> If it is, instinct suggests that the same issue will apply to many
> (most?) of the projections, not just Wagner I.

I believe this fix is correct. It fixes the longitudal wrap. I hope you 
can get it accepted into PROJ, for all projections that need it.

For latitudal wraps, see below.

> Also, I had to disable the remaining call to bordwalk() in r.proj,
> otherwise it cropped the result. Realistically, I think that we need a
> flag to allow the bordwalk() call(s) to be disabled for the cases
> where they don't work correctly.

Yes, agree, though "don't work correctly" may have other reasons than
those inherent in bordwalk() itself. But the flag should be applied to
both calls to bordwalk() from main.c, not just to the second. Right now
the first call ("crop the input to current region") is unconditionally
disabled with '#if 0'. Also, region settings are read from DEFAULT_WIND,
instead of WIND. This causes a) the complete input map to be read into
memory and b) region sensitivity is no longer effective.


If you are working only with global maps this may be what you want, but
others will complain if we release the code like it is now ("r.proj 
requires too much memory", "r.proj creates maps that are completely 
outside my location", "why do I get these 'north must be greater than 
south' errors" etc).

My suggestion is to keep both calls to bordwalk(), but make the 'nocrop' 
flag indicate whether to run the routines or not. And to restore region 
sensitivity by reading the environment from WIND.


---
As for the latitudal wraps I think the problem is your region settings.

I understood from the comments to this topic that catching latitudal wraps
in PROJ may be almost undoable. But the GRASS user can avoid them by
setting the location borders carefully:



More information about the grass-dev mailing list