0
点赞
收藏
分享

微信扫一扫

Gdal3.1.4 设置支持PROJ中文路径

老牛走世界 2022-04-01 阅读 83
c#

程序路径包含中文时,使用Path.Combine(AppDomain.CurrentDomain.BaseDirectory, “proj6”, “share”) 传入 Osr.SetPROJSearchPath 会提示找不到proj.db

报错: PROJ: proj_create_from_database: Cannot find proj.db

偶然尝试传入"./proj6/share" 发现没有问题

Gdal.AllRegister();
Ogr.RegisterAll();
Gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
// Osr.SetPROJSearchPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "proj6", "share"));
Osr.SetPROJSearchPath("./proj6/share");
var sp = new SpatialReference("");
var importFromEpsg = sp.ImportFromEPSG(4326);

注:Gdal 3.1.4 支持.NetFramework 4.0

举报

相关推荐

0 条评论