我gdal
在 iOS 上编译时遇到了一些问题(gdal
内部proj
用于某些操作)
我正在为 iOS 开发,并且想使用这个库来执行坐标转换,但是有些函数需要proj dll
并且在运行时我得到这个错误:
ERROR 6: Unable to load PROJ.4 library (libproj.dylib), creation of
OGRCoordinateTransformation failed.
Transformation failed.
我想 proj dll 应该作为静态库包含,但我找不到如何执行此操作
(其他问题,仅提一下:我无法访问EPSG
数据库,也无法访问gcs.csv
,因此SetGeogCS()
似乎只有方法可用于设置坐标系,但我不知道应该使用哪些参数来获取“ EPSG:3003
”坐标系,“意大利扶桑 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);
}
}