0

When trying to execute GRASS7s r.slope.aspect from QGIS using a custom application, no output is written on macOS. However, the algorithm runs fine and no error message is appearing. Doing the same on Windows runs just fine.

However, executing the algorithm in QGIS GUI works fine on macOS.

Input DEM: https://www.dropbox.com/s/mj7d42la95jlo3a/elevation.asc?dl=0

# export path variables
export DYLD_LIBRARY_PATH=/Applications/QGIS.app/Contents/MacOS/lib/:/Applications/QGIS.app/Contents/Frameworks/
export PYTHONPATH=/Applications/QGIS.app/Contents/Resources/python/
export QGIS_PREFIX_PATH=/Applications/QGIS.app/Contents/MacOS/
export PATH='/Applications/QGIS.app/Contents/MacOS/bin:$PATH'

# execute function
/usr/bin/python
import os
import sys
from qgis.core import *
from osgeo import ogr
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.gui import *
QgsApplication.setPrefixPath(r'/Applications/QGIS.app/Contents', True)
app = QgsApplication([], True)
QgsApplication.initQgis()
sys.path.append(r'/Applications/QGIS.app/Contents/Resources/python/plugins')
from processing.core.Processing import Processing
Processing.initialize()
import processing
processing.runalg('grass7:r.slope.aspect', '/var/folders/5j/_1ts10x512sg_5q_3kzc_c1w0000gn/T/RtmpFnbVld/elevation.asc', '0', '0', 'True', '1.0', '0.0', '794599.107614635,798208.557614635,8931774.87460253,8935384.32460253', '0.0', '/var/folders/5j/_1ts10x512sg_5q_3kzc_c1w0000gn/T/RtmpFnbVld/slope.tif', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None')
  • Probably because you set 'None' as output? What happens if you use None instead? – mgri Dec 13 '16 at 14:12
  • Thanks for the hint. However this change makes no difference. Nevertheless we will change that in our application. – pat-s Dec 13 '16 at 14:55
  • I think that would be changed because, by now, the output is a string (that is possible, but only if the string points towards a path).. I'm unfamiliar with standalone applications, but you could have a look to this discussion. – mgri Dec 13 '16 at 15:02
1

The following export statement prevents that the output file is written:

export PATH='/Applications/QGIS.app/Contents/MacOS/bin:$PATH'

When using only the first three exports statements from the questions, everything works fine on macOS.

However, the reason for this behavior is unknown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.