Skip to content

Commit

Permalink
Merge pull request #173 from Esri/chs_update_proxy_csv_fix_172
Browse files Browse the repository at this point in the history
fix for resume proxy CSV update #172
  • Loading branch information
Chamlika authored Oct 24, 2024
2 parents fdaf84a + 17b3dd3 commit 686768c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions OptimizeRasters.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# ------------------------------------------------------------------------------
# Name: OptimizeRasters.py
# Description: Optimizes rasters via gdal_translate/gdaladdo
# Version: 20240430
# Version: 20241024
# Requirements: Python
# Required Arguments: -input -output
# Optional Arguments: -mode -cache -config -quality -prec -pyramids
Expand Down Expand Up @@ -4565,10 +4565,12 @@ def compress(self, input_file, output_file, args_callback=None, build_pyramids=T
if (not kwargs[UpdateOrjobStatus]):
isRasterProxyCaller = True
if (_rpt):
if (input_file in _rpt._input_list_info and
Report.CRPT_URL_TRUENAME in _rpt._input_list_info[input_file]):
output_file = '{}/{}'.format(os.path.dirname(
output_file), _rpt._input_list_info[input_file][Report.CRPT_URL_TRUENAME])
if input_file in _rpt._input_list_info:
if _rpt._input_list_info[input_file][CRPT_PROCESSED] == "yes":
return True
if (Report.CRPT_URL_TRUENAME in _rpt._input_list_info[input_file]):
output_file = '{}/{}'.format(os.path.dirname(
output_file), _rpt._input_list_info[input_file][Report.CRPT_URL_TRUENAME])
_vsicurl_input = self.m_user_config.getValue(CIN_S3_PREFIX, False)
_input_file = input_file.replace(
_vsicurl_input, '') if _vsicurl_input else input_file
Expand Down Expand Up @@ -5412,8 +5414,8 @@ def makedirs(filepath):


class Application(object):
__program_ver__ = 'v2.0.11'
__program_date__ = '20240430'
__program_ver__ = 'v2.0.13'
__program_date__ = '20241024'
__program_name__ = 'OptimizeRasters.py {}/{}'.format(
__program_ver__, __program_date__)
__program_desc__ = 'Convert raster formats to a valid output format through GDAL_Translate.\n' + \
Expand Down Expand Up @@ -7092,10 +7094,15 @@ def run(self):
if (self._base._isRasterProxyFormat('csv')):
pfname = cfg.getValue('rpfname', False)
if (pfname):
use_existing = os.path.exists(pfname)
obj_id = 0
if use_existing:
obj_id = int(time.time()) % 100000000
with open(pfname, 'a') as rpWriter:
rpWriter.write('ObjectID;Raster\n')
for i in range(0, len(self._base._modifiedProxies)):
proxyStr = self._base._modifiedProxies[i]
if not use_existing:
rpWriter.write('ObjectID;Raster\n')
for i in range(obj_id, obj_id + len(self._base._modifiedProxies)):
proxyStr = self._base._modifiedProxies[i- obj_id]
proxyStr = ' '.join(
proxyStr.split()).replace('"', '\'')
proxyStr = '><'.join(proxyStr.split('> <'))
Expand Down
Binary file modified Setup/OptimizeRastersToolsSetup.exe
Binary file not shown.

0 comments on commit 686768c

Please sign in to comment.