DatasourceConnectionInfo datasourceConnectionInfo = DatasourceUtils.openFileDatasourceConnectionInfo(udbxFilePath);
datasourceConnectionInfo.setEngineType(EngineType.UDBX);
// 将文件写入到udbx文件
DataImport dataImport = new DataImport();
ImportSetting setting = null;
if (sourceFilePath.toLowerCase().endsWith("3ds")) {
setting = new ImportSettingModelOSG();//ImportSettingModel3DS();
log.info("文件转换 3ds");
} else {
throw new Exception("不支持的数据类型!");
}
setting.setImportMode(ImportMode.OVERWRITE);
setting.setSourceFilePath(sourceFilePath);
setting.setTargetDatasourceConnectionInfo(datasourceConnectionInfo);
setting.setTargetDatasetName("JZMX1");
// 设置投影坐标
PrjCoordSys prjCoordSys = new PrjCoordSys(4490);
setting.setTargetPrjCoordSys(prjCoordSys);
dataImport.getImportSettings().add(setting);
dataImport.run();
log.info("文件转换udbx,udbx文件:【{}】,长度2:{}", udbxFilePath,udbxFile.length());
dataImport.dispose();
datasourceConnectionInfo.dispose();
上方代码在windows下可以成功将3ds导入udbx,但在linux下没有生成数据,请问是为什么?
下方是linux下的代码日志(可以看出3ds转udbx只花了0.3秒,但实际上并没有生成结果,而windows上执行花了3秒,有正确的结果):
2024-11-19 14:58:55.731 INFO 1 --- [ XNIO-1 task-1] c.t.x.c.a.facade.ProjectFacadeImpl : 文件转换udbx,源文件:【/temp/convertudbx/673c372ff373b81c3b5428f3/jzmx.3ds】,长度:118328
Tue, Nov 19 2024 2:58:55 pm2024-11-19 14:58:55.759 INFO 1 --- [ XNIO-1 task-1] c.t.x.c.a.facade.ProjectFacadeImpl : 文件转换udbx,udbx文件:【/temp/convertudbx/673c372ff373b81c3b5428f3/jzmx.udbx】,长度1:6078464
Tue, Nov 19 2024 2:58:57 pm2024-11-19 14:58:57.285 INFO 1 --- [ XNIO-1 task-1] c.t.x.c.a.facade.ProjectFacadeImpl : 文件转换 3ds
Tue, Nov 19 2024 2:58:57 pm2024-11-19 14:58:57.543 INFO 1 --- [ XNIO-1 task-1] c.t.x.c.a.facade.ProjectFacadeImpl : 文件转换udbx,udbx文件:【/temp/convertudbx/673c372ff373b81c3b5428f3/jzmx.udbx】,长度2:6094848
Tue, Nov 19 2024 2:58:57 pm2024-11-19 14:58:57.543 INFO 1 --- [ XNIO-1 task-1] c.t.x.c.a.facade.ProjectFacadeImpl : 文件转换udbx,导入源文件到udbx文件中
Tue, Nov 19 2024 2:58:57 pm2024-11-19 14:58:57.544 INFO 1 --- [ XNIO-1 task-1] c.t.x.c.a.facade.ProjectFacadeImpl : 文件转换udbx,关闭资源