OpenWaterFoundation / owf-app-geoprocessor-python

Open Water Foundation geoprocessor based on QGIS
GNU General Public License v3.0
2 stars 1 forks source link

RasterizeGeoLayer command retains locks on temporary files #347

Open smalers opened 4 years ago

smalers commented 4 years ago

The RasterizeGeoLayer command uses the gdal:rasterize algorithm to do the work. This algorithm seems to retain a lock on the temporary files and consequently they cannot be removed. The work-around is that the command uses a unique timestamped name for temporary files. The downside is that this will eat up disk space. Some ideas for solving include:

  1. Research PyQGIS solutions. Preliminary results indicate that others have had similar issues. Need to do this regardless to find an elegant solution. Maybe newer versions of QGIS/GDAL/OGR will fix the problem.
  2. Implement some tracker with list of files that should be removed. When the GeoProcessor starts up, it can remove the temporary files from the previous session.
smalers commented 2 years ago

Other commands have similar locking issues that cause workflows to not complete. I found this GitHub issue related to R integration that may offer some clues.

smalers commented 5 months ago

I fixed the IntersectGeoLayer command to use unique temporary GeoPackage temporary files, when files are needed by the QGIS algorithm. This seems to solve the problem and could be implemented for other commands. It does use more disk space, but the GeoProcessor has a way to track temporary files between sessions and delete on the next startup. There is also a QGIS "scratch layer" type, that I need to evaluate. Keep this issue open for now.