[PROJ] [PROJ 6.0.0] Different behaviors for creating a transformation of type EPSG:9616

Didier Richard Didier.Richard at ign.fr
Tue Apr 30 06:06:43 PDT 2019


Hi all,

Still on library testing, I try to create using different methods a transformation that exists in the proj.db, in other_transformation table (IGNF:TSG1250 which is EPSG:9616 method) :

1.- using proj_create : fails ;
2.- using proj_create_from_database : succeed but got a type different from the one given to the function ;
3.- using proj_create_from_name : succeed but got a type which is not PJ_TYPE_OTHER_COORDINATE_OPERATION (expected).

Any thoughts on these differences between function calls and return transformation types ?

The code :

#include <stdio.h>
#include <string.h>
#include "proj.h"

int main ( int argc, char *argv[] ) {
    PJ_CONTEXT *c;
    PJ_OBJ_LIST *list;
    PJ_TYPE types[] = { PJ_TYPE_CONVERSION, PJ_TYPE_TRANSFORMATION, PJ_TYPE_CONCATENATED_OPERATION, PJ_TYPE_OTHER_COORDINATE_OPERATION };
    PJ *obj;
    PJ_PROJ_INFO info;
    int i, n;
    const char *wkt;

    fprintf(stderr,"PJ_TYPE_CONVERSION = %d\n", PJ_TYPE_CONVERSION);
    fprintf(stderr,"PJ_TYPE_TRANSFORMATION = %d\n", PJ_TYPE_TRANSFORMATION);
    fprintf(stderr,"PJ_TYPE_CONCATENATED_OPERATION = %d\n", PJ_TYPE_CONCATENATED_OPERATION);
    fprintf(stderr,"PJ_TYPE_OTHER_COORDINATE_OPERATION = %d\n", PJ_TYPE_OTHER_COORDINATE_OPERATION);
    c = proj_context_create();

    obj = proj_create(c, "IGNF:SG1250");
    if ( obj != NULL ) {
        fprintf(stderr,"IGNF:TSG1250 created as %d\n", proj_get_type(obj));
        info = proj_pj_info(obj);
        fprintf(stderr,"Info :\nID:%s\nDesc:%s\nDef:%s\nInv:%d\nAcc:%f\n", info.id, info.description, info.definition, info.has_inverse, info.accuracy);
        proj_destroy(obj);
    }

    for ( i = 0; i < 4 ; i++) {
        obj = proj_create_from_database(c, "IGNF", "TSG1250", types[i], 0, NULL);
        if ( obj != NULL ) {
            fprintf(stderr,"IGNF:TSG1250 created as %d but has type %d ?!\n", types[i], proj_get_type(obj));
            info = proj_pj_info(obj);
            fprintf(stderr,"Info :\nID:%s\nDesc:%s\nDef:%s\nInv:%d\nAcc:%f\n", info.id, info.description, info.definition, info.has_inverse, info.accuracy);
            proj_destroy(obj);
        }
    }

    list = proj_create_from_name(c,"IGNF","NGF-IGN 1969 vers EVRF2000",types,4,1,0,NULL);
    if (list == NULL) {
        fprintf(stderr,"Error : %s\n", proj_errno_string(proj_context_errno(c)));
        return 1;
    }
    n = proj_list_get_count(list);
    fprintf(stderr, "found %d object(s) :\n", n);
    for ( i = 0; i < n; i++) {
        obj = proj_list_get(c, list, i);
        fprintf(stderr,"found %s of type %d\n", proj_get_name(obj), proj_get_type(obj));
        info = proj_pj_info(obj);
        fprintf(stderr,"Info :\nID:%s\nDesc:%s\nDef:%s\nInv:%d\nAcc:%f\n", info.id, info.description, info.definition, info.has_inverse, info.accuracy);
        proj_destroy(obj);
    }
    proj_list_destroy(list);
    proj_context_destroy(c); /* may be omitted in the single threaded case */
    return 0;
}

The output :

PJ_TYPE_CONVERSION = 21
PJ_TYPE_TRANSFORMATION = 22
PJ_TYPE_CONCATENATED_OPERATION = 23
PJ_TYPE_OTHER_COORDINATE_OPERATION = 24
proj_create: crs not found
IGNF:TSG1250 created as 21 but has type 0 ?!
Info :
ID:(null)
Desc:ISO-19111 object
Def:
Inv:0
Acc:-1.000000
IGNF:TSG1250 created as 22 but has type 0 ?!
Info :
ID:(null)
Desc:ISO-19111 object
Def:
Inv:0
Acc:-1.000000
IGNF:TSG1250 created as 23 but has type 0 ?!
Info :
ID:(null)
Desc:ISO-19111 object
Def:
Inv:0
Acc:-1.000000
IGNF:TSG1250 created as 24 but has type 0 ?!
Info :
ID:(null)
Desc:ISO-19111 object
Def:
Inv:0
Acc:-1.000000
found 1 object(s) :
pj_ellipsoid - final: a=6378137.000 f=1/298.257, errno=0
pj_ellipsoid - final:    ellps=GRS80
found NGF-IGN 1969 vers EVRF2000 (UELN-95/98)(EUROPEAN VERTICAL REFERENCE FRAME) of type 22
Info :
ID:geogoffset
Desc:NGF-IGN 1969 vers EVRF2000 (UELN-95/98)(EUROPEAN VERTICAL REFERENCE FRAME)
Def:proj=geogoffset dh=-0.486 ellps=GRS80
Inv:1
Acc:-1.000000

Regards,
--
RICHARD Didier - Chef du Centre de Compétences Technologies des Systèmes d'Information
http://fr.linkedin.com/pub/didier-richard/98/2a3/a8/ - https://www.osgeo.org/member/didier/
IGN/Direction des Sciences et Technologies de l'Information/ENSG Géomatique
6/8 avenue Blaise Pascal - BP Champs-sur-Marne - 77455 MARNE-LA-VALLÉE CEDEX 2
Tél : +33 (0) 1 43 98 83 23



More information about the PROJ mailing list