[Proj] [AXIS] pj_init parsing issues
Frank Warmerdam
warmerdam at pobox.com
Fri Nov 12 07:53:06 PST 2010
RICHARD Didier wrote:
> Hi devs,
>
> I am preparing a ticket for PROJ4JS for axis handling and looking at the
> code of pj_init.c when parsing +axis= (trunk version) :
>
>
> /* axis orientation */
> if( (pj_param(ctx, start,"saxis").s) != NULL )
> {
> static const char *axis_legal = "ewnsud";
> const char *axis_arg = pj_param(ctx, start,"saxis").s;
> [1] if( strlen(axis_arg) != 3 )
> {
> pj_ctx_set_errno( ctx, PJD_ERR_AXIS );
> goto bum_call;
> }
>
> if( strchr( axis_legal, axis_arg[0] ) == NULL
> || strchr( axis_legal, axis_arg[1] ) == NULL
> [2] || (axis_arg[2] && strchr( axis_legal, axis_arg[1] ) == NULL))
> {
> pj_ctx_set_errno( ctx, PJD_ERR_AXIS );
> goto bum_call;
> }
>
> /* it would be nice to validate we don't have on axis repeated */
> strcpy( PIN->axis, axis_arg );
> }
>
>
> it seems to me that :
>
> [1] implies axis_arg length is 3 : is there any problem with 2D only CRS
> (although pj_transform() and pj_adjust_axis() check that) ?
Didier,
I agree that it is desirable to allow 2D axis definitions in which case
the first two would need to be in [ewns] and the third would be assumed
to be "u" when needed.
> [2] if length is 3 then axis_arg[2] is defined and the comparizon should
> be done versus axis_arg[2] and not axis_arg[1] ?
Yes, this does look like a bug.
Could you file a ticket on this? Feel free to also fix it if you are
comfortable doing so.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Proj
mailing list