[PROJ] [PROJ 6.0.0] proj_create_operation_factory_context behavior
Didier Richard
Didier.Richard at ign.fr
Tue Apr 30 04:39:34 PDT 2019
Hi all,
While testing the library, the creation of a transformation between two specific CRS leads me facing 2 challenges :
1.- Despite the fact that the two CRS (Réunion island and French Antilles) have disjoint areas an operation is created.
The documentation expressed that default behavior for areas is "Strict containment", I, then, expected to have 0 operations in the end ...
If I set acc to 1.0, then, I got the right answer because the Ballpark transformation is removed.
2.- On the latter point, when acc equals 0.0, the candidate operation is pipeline containing a Ballpark transformation, proj_coordoperation_has_ballpark_transformation() still returns false ...
Any thoughts ?
The code :
#include <stdio.h>
#include <string.h>
#include "proj.h"
int main ( int argc, char *argv[] ) {
PJ_CONTEXT *c;
PJ *src, *tgt;
PJ_PROJ_INFO info;
PJ_OPERATION_FACTORY_CONTEXT *factory;
PJ_OBJ_LIST *results;
double acc = 0.0;
src = proj_create(c, "IGNF:REUN47GAUSSL"); // area : 55.17,-21.42,55.92,-20.76
tgt = proj_create(c, "IGNF:RGAF09UTM20"); // area : -63.2,14.25,-60.73,18.2
// areas are strictly disjoint ... intersection is then empty
factory = proj_create_operation_factory_context(c,NULL);
if (factory == NULL) {
fprintf(stderr,"Error : %s\n", proj_errno_string(proj_context_errno(c)));
return 1;
}
results = proj_create_operations(c, src, tgt, factory);
if (results == NULL) {
fprintf(stderr,"No operation between '%s' and '%s'\n", proj_get_name(src), proj_get_name(tgt));
} else {
int i, n;
PJ *ope;
n = proj_list_get_count(results);
fprintf(stderr,"%d operation(s) found :\n", n);
for (i = 0; i < n ; i++) {
ope = proj_list_get(c, results, i);
info = proj_pj_info(ope);
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);
fprintf(stderr,"operation does %shave ballpark\n", proj_coordoperation_has_ballpark_transformation(c, ope)? "":"not ");
if (strstr(proj_get_name(ope), "Ballpark") != NULL) {
fprintf(stderr,"operation does have ballpark in its name !!!!\n");
}
fprintf(stderr,"'%s'\n", proj_get_name(ope));
proj_destroy(ope);
}
proj_list_destroy(results);
}
proj_operation_factory_context_destroy(factory);
proj_destroy(src);
proj_destroy(tgt);
proj_context_destroy(c); /* may be omitted in the single threaded case */
return 0;
}
The output:
1 operation(s) found :
Info :
ID:pipeline
Desc:Inverse of GAUSS LABORDE REUNION + Ballpark geographic offset from Reunion Piton des Neiges geographiques (dms) to RGAF09 geographiques (dms) + UTM NORD FUSEAU 20
Def:proj=pipeline step inv proj=gstmerc lat_0=-21.1166666667 lon_0=55.5333333333 k_0=1 x_0=160000 y_0=50000 ellps=intl step proj=utm zone=20 ellps=GRS80
Inv:1
Acc:-1.000000
operation does not have ballpark
operation does have ballpark in its name !!!!
'Inverse of GAUSS LABORDE REUNION + Ballpark geographic offset from Reunion Piton des Neiges geographiques (dms) to RGAF09 geographiques (dms) + UTM NORD FUSEAU 20'
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