GDAL in iOS, runtime dll proj4 not available, OGR functions do not work -
i have problems gdal
compiled on ios ( gdal
internally uses proj
operations )
i'm developing ios, , want use library perform coordinate transformation, functions requires proj dll
, @ runtime error :
error 6: unable load proj.4 library (libproj.dylib), creation of ogrcoordinatetransformation failed. transformation failed.
i suppose proj dll should included static library , can't find how todo this
( other problems, mention: can't access epsg
database , gcs.csv
neither, setgeogcs()
methos seems available set coordinate system, bu don't' know parameters should use "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); } }
you need download , build proj4 ios first. can point gdal ios build of proj4 using ./configure flag
--with-static-proj4=/path/to/your/libproj
make sure path parent directory has include directory , lib directory proj4.
for instance directory on mac is:
/users/myusername/ios_builds/{device_arch}/iphoneos.platform/iphoneos.7.0.sdk
where device arch can i386, armv7 or armv7s depending on target compiling for. directory has subdirectories of "include" , "lib", in turn have .h files , libproj.a file linking gdal.
i have script in development helping build gdal , associated libraries on github. https://github.com/afarnham/preflight
you might have make edits compilers specified in script work if don't have xcode 5 installed. of configure flags need updating gdal. should started though.
Comments
Post a Comment