完整错误如下
Warning 1: PROJ: proj_create_from_database: C:\Program Files\PostgreSQL\14\share\contrib\postgis-3.2\proj\proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 6 is expected. It comes from another PROJ installation.
Warning 1: The definition of projected CRS EPSG:32650 got from GeoTIFF keys is not the same as the one from the EPSG registry, which may cause issues during reprojection operations. Set GTIFF_SRS_SOURCE configuration option to EPSG to use official parameters (overriding the ones from GeoTIFF keys), or to GEOKEYS to use custom values from GeoTIFF keys and drop the EPSG code.
其实根本原因是,proj找proj.db时找到了老版本的,那么proj是如何找到proj.db呢?答案就是通过
PROJ_DATA环境变量。那么要想让它找到正确的PROJ_DATA就是重写PROJ_DATA就行了,例如我这里是这样写的
if (!qputenv("PROJ_DATA", (qgis.pkgDataPath() + "/resources/proj").toUtf8()))
{
qDebug() << QStringLiteral("PROJ_DATA设置失败");
}