使用产品:iobjectspy python 操作系统:win11 x64
数据类型 .tiff
问题详细描述:
执行export_to_tif()函数时,有以下报错:
[2024-06-20 09:32:12, ERROR, 29212, conversion, 2003]: Traceback (most recent call last):
File "D:\BuildAgent\work\test_master/iobjectspy/_jsuperpy\conversion.py", line 1996, in _export_dataset_to_file
File "D:\BuildAgent\work\test_master/iobjectspy/_jsuperpy\_utils.py", line 515, in oj
AttributeError: 'str' object has no attribute '_jobject'
返回该函数的结果,结果为False
执行的代码块:
对应的代码块如下,该代码块旨在导入一个.tif文件为结果数据集,然后直接将该结果数据集再导出为.tif文件。
from iobjectspy import (import_tif,
open_datasource,
create_datasource,
export_to_tif,
)
import os
def _create_or_open_datasource(path_file):
if os.path.exists(path_file):
return open_datasource(path_file)
else:
return create_datasource(path_file)
tiff_path = r'B:\数据\Extract\TEST_0.tiff'
out_dir = r'B:\数据\Extract\TESTdir'
out_ds = _create_or_open_datasource(os.path.join(out_dir, 'TEST.udbx'))
out_file = os.path.join(out_dir, 'TEST.tiff')
result = import_tif(tiff_path,
out_ds,
out_dataset_name=None,
ignore_mode='IGNORESIGNAL',
ignore_values=[],
multi_band_mode=None,
world_file_path=None,
is_import_as_grid=True,
is_build_pyramid=False,
progress=None
)
output_try = export_to_tif(result,
out_file,
is_over_write=True,
export_as_tile=False,
export_transform_file=False,
progress=None)
print(output_try)
out_ds.close()
备注:
SuperMap iObjects Java已按文档进行配置,导入.tif为结果数据集是没问题的,结果数据集的.udbx'文件也是正常的。唯一问题就是导出为.tif文件会报错。
iobjectspy是pip安装的,版本为10.2.0;SuperMap iObjects Java的bin包版本为11.1.1;Java version是1.8.0, x64的。