[Proj] [AXIS] pj_init parsing issues

RICHARD Didier didier.richard at ign.fr
Fri Nov 12 08:14:13 EST 2010


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) ?

[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] ?

Sincerely,

didier
-- 
RICHARD Didier - Chef du pôle technique du Géoportail
2/4, avenue Pasteur - 94165 Saint Mandé Cedex
Tél : +33 (0) 1 43 98 83 23


More information about the Proj mailing list