Closed aaschwanden closed 7 years ago
Hi Andy,
you can change the line https://github.com/semiautomaticgit/SemiAutomaticClassificationPlugin/blob/master/core/utils.py#L650
Are gdalwarp and gdalbuildvrt in the same directory?
Luca
Thanks Luca, I'll give it a try.
Alright, hard coding the path works.
Maybe a more elegant way could be (inspired by https://gist.github.com/techtonik/4368898):
import os
import sys
def find_executable(executable, path=None):
"""Find if 'executable' can be run. Looks for it in 'path'
(string that lists directories separated by 'os.pathsep';
defaults to os.environ['PATH']). Checks for all executable
extensions. Returns full path or None if no command is found.
"""
if path is None:
path = os.environ['PATH']
paths = path.split(os.pathsep)
extlist = ['']
if os.name == 'os2':
(base, ext) = os.path.splitext(executable)
# executable files on OS/2 can have an arbitrary extension, but
# .exe is automatically appended if no dot is present in the name
if not ext:
executable = executable + ".exe"
elif sys.platform == 'win32':
pathext = os.environ['PATHEXT'].lower().split(os.pathsep)
(base, ext) = os.path.splitext(executable)
if ext.lower() not in pathext:
extlist = pathext
for ext in extlist:
execname = executable + ext
if os.path.isfile(execname):
return execname
else:
for p in paths:
f = os.path.join(p, execname)
if os.path.isfile(f):
return f
else:
return None
fg.gdalPath = os.path.split(find_executable('gdal_translate'))[0]
Works for me with my OSX / MacPorts and with the latest Ubuntu, but I don't have access to a Windows machine.
A.
Thank you very much. Actually I think that in your case if you set cfg.gdalPath = "" it should work. Could you please test this?
Luca,
yes this works for me.
Now the pansharpening appears to work despite an error after the conversion process:
Traceback (most recent call last): File "/Users/andy/.qgis2/python/plugins/raster_transparency/rastertransparency.py", line 150, in layerChanged maxValue = int(stat.maximumValue) OverflowError: cannot convert float infinity to integer
that appears when SCP tries to load the layers back into QGIS. Some of the bands have NaN as min/max values, could that be the culprit? I've checked with my Ubuntu QGIS and the exactly same Landsat scene. Some bands also have NaN min/max values, but I don't get an error from SCP.
Anyway, now I can explore the plugin, which looks amazing.
Andy
On Thu, Aug 25, 2016 at 12:42 PM, Luca Congedo notifications@github.com wrote:
Thank you very much. Actually I think that in your case if you set cfg.gdalPath = "" it should work. Could you please test this?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/semiautomaticgit/SemiAutomaticClassificationPlugin/issues/6#issuecomment-242532994, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHXenOWcqYLP1hABp_qPCXo-p7ZcYHYks5qjf4ogaJpZM4JsW5y .
Thank you Andy. I am going to fix the path issue in the next version of SCP.
Yes, that error is caused by the plugin raster_transparency when the band contains Nan values usually for NoData.
Best regards, Luca
Hi,
I'm using QGIS 2.16.1 installed on my Mac OSX 10.11.6 with MacPorts.
For some reason, SCP picks up the wrong path to GDAL:
2016-08-19 13.11.47.117901 SemiAutomaticClassificationPlugin.core.utils-GDALCopyRaster 2900 GDAL error:: /bin/sh: /Library/Frameworks/GDAL.framework/Versions/2.1/Programs/gdal_translate: No such file or directory
I don't know how SCP looks for GDAL, sincepoints to the correct path to GDAL. So the question is: How can I convince SIP that my GDAL installation is in /opt/local, not in /Library/Frameworks? I will try to brute-force remove /Library/Frameworks/GDAL.framework (as I don't recall where this is coming from, I'm sure I don't need it), but this is a somewhat inelegant solution. Note that /Library/Frameworks/GDAL.framework/Versions/2.1/Programs/ is not in my search path:
Andy