I have some problems with gdal
compiled on iOS ( gdal
internally uses proj
for some operations )
I'm developing for iOS, and want to use this library to perform coordinate transformation, but some functions requires proj dll
and at runtime i get this error :
ERROR 6: Unable to load PROJ.4 library (libproj.dylib), creation of
OGRCoordinateTransformation failed.
Transformation failed.
I suppose that the proj dll should be included as a static library , but i can't find how todo this
( other problems, just to mention: i can't access EPSG
database and gcs.csv
neither, so that only SetGeogCS()
methos seems available to set coordinate system, bu i don't' know which parameters i should use to get a "EPSG:3003
" coordinate system, "Italia fuso ovest" )
CLLocationCoordinate2D transform( char *s_srs, double x, double y)
{
OGRSpatialReference oSourceSRS, oTargetSRS;
OGRCoordinateTransformation *poCT;
/* oSourceSRS.importFromEPSG( atoi(papszArgv[i+1]) );
//oTargetSRS.importFromEPSG( atoi(papszArgv[i+2]) ); */
/*
oSourceSRS.SetWellKnownGeogCS(s_srs);
*/
oSourceSRS.SetGeogCS( "My geographic coordinate system",
"WGS_1984",
"My WGS84 Spheroid",
SRS_WGS84_SEMIMAJOR, SRS_WGS84_INVFLATTENING,
"Greenwich", 0.0,
"degree",
atof(SRS_UA_DEGREE_CONV) );
/*
oTargetSRS.SetWellKnownGeogCS("WGS84");
*/
oTargetSRS.SetGeogCS( "My geographic coordinate system",
"WGS_1984",
"My WGS84 Spheroid",
SRS_WGS84_SEMIMAJOR, SRS_WGS84_INVFLATTENING,
"Greenwich", 0.0,
"degree",
atof(SRS_UA_DEGREE_CONV) );
poCT = OGRCreateCoordinateTransformation( &oSourceSRS,
&oTargetSRS );
if( poCT == NULL || !poCT->Transform( 1, &x, &y ) ) {
printf( "Transformation failed.\n" );
return CLLocationCoordinate2DMake(x, y);
} else {
return CLLocationCoordinate2DMake(x, y);
}
}