Skip to content
Permalink
Browse files

OTB plugin modification for OTB 7.1

  • Loading branch information
Cédric Traizet authored and nyalldawson committed Mar 24, 2020
1 parent 8717c77 commit fb419b638d199f48e70d812c60b213ad0f30ba70
@@ -119,10 +119,12 @@ def getExecutableInPath(path, exe):
def getAuxiliaryDataDirectories():
gdal_data_dir = None
gtiff_csv_dir = None
proj_dir = None
otb_folder = OtbUtils.otbFolder()
if os.name == 'nt':
gdal_data_dir = os.path.join(otb_folder, 'share', 'data')
gtiff_csv_dir = os.path.join(otb_folder, 'share', 'epsg_csv')
proj_dir = os.path.join(otb_folder, 'share', 'proj')
else:
env_profile = os.path.join(otb_folder, 'otbenv.profile')
try:
@@ -137,24 +139,28 @@ def getAuxiliaryDataDirectories():
gdal_data_dir = line.split("GDAL_DATA=")[1]
if 'GEOTIFF_CSV='in line:
gtiff_csv_dir = line.split("GEOTIFF_CSV=")[1]
if 'PROJ_LIB='in line:
proj_dir = line.split("PROJ_LIB=")[1]
except BaseException as exc:
errmsg = "Cannot find gdal and geotiff data directory." + str(exc)
QgsMessageLog.logMessage(errmsg, OtbUtils.tr('Processing'), Qgis.Info)
pass

return gdal_data_dir, gtiff_csv_dir
return gdal_data_dir, gtiff_csv_dir, proj_dir

@staticmethod
def executeOtb(commands, feedback, addToLog=True):
otb_env = {
'LC_NUMERIC': 'C',
'GDAL_DRIVER_PATH': 'disable'
}
gdal_data_dir, gtiff_csv_dir = OtbUtils.getAuxiliaryDataDirectories()
gdal_data_dir, gtiff_csv_dir, proj_dir = OtbUtils.getAuxiliaryDataDirectories()
if gdal_data_dir and os.path.exists(gdal_data_dir):
otb_env['GDAL_DATA'] = gdal_data_dir
if gtiff_csv_dir and os.path.exists(gtiff_csv_dir):
otb_env['GEOTIFF_CSV'] = gtiff_csv_dir
if proj_dir and os.path.exists(proj_dir):
otb_env['PROJ_LIB'] = proj_dir

otb_env['OTB_LOGGER_LEVEL'] = OtbUtils.loggerLevel()
max_ram_hint = OtbUtils.maxRAMHint()
@@ -23,7 +23,7 @@ tests:
name: raster.tif
type: file
type: gaussian
type.gaussian.radius: 4.0
type.gaussian.stdev: 4.0
results:
out:
hash: b3fbccd6f41052317a435567a2633dae1d9b66772a4d8a3323d9b1c5

0 comments on commit fb419b6

Please sign in to comment.
You can’t perform that action at this time.