kopia lustrzana https://github.com/OpenDroneMap/WebODM
GRASS engine working
rodzic
f3c6ac6a48
commit
c0899c96ff
|
@ -3,6 +3,7 @@ import shutil
|
|||
import tempfile
|
||||
import subprocess
|
||||
import os
|
||||
import platform
|
||||
|
||||
from webodm import settings
|
||||
|
||||
|
@ -80,16 +81,33 @@ class GrassContext:
|
|||
# Create param list
|
||||
params = ["{}={}".format(opt,value) for opt,value in self.script_opts.items()]
|
||||
|
||||
# Track success, output
|
||||
success = False
|
||||
out = ""
|
||||
err = ""
|
||||
|
||||
# Execute it
|
||||
logger.info("Executing grass script from {}: {} -c {} location --exec python {} {}".format(self.get_cwd(), self.grass_binary, self.location, script, " ".join(params)))
|
||||
p = subprocess.Popen([self.grass_binary, '-c', self.location, 'location', '--exec', 'python', script] + params,
|
||||
cwd=self.get_cwd(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
|
||||
command = [self.grass_binary, '-c', self.location, 'location', '--exec', 'python', script] + params
|
||||
if platform.system() == "Windows":
|
||||
# communicate() hangs on Windows so we use check_output instead
|
||||
try:
|
||||
out = subprocess.check_output(command, cwd=self.get_cwd()).decode('utf-8').strip()
|
||||
success = True
|
||||
except subprocess.CalledProcessError:
|
||||
success = False
|
||||
err = out
|
||||
else:
|
||||
p = subprocess.Popen(command, cwd=self.get_cwd(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
out, err = p.communicate()
|
||||
|
||||
out = out.decode('utf-8').strip()
|
||||
err = err.decode('utf-8').strip()
|
||||
out = out.decode('utf-8').strip()
|
||||
err = err.decode('utf-8').strip()
|
||||
success = p.returncode == 0
|
||||
|
||||
if p.returncode == 0:
|
||||
if success:
|
||||
return out
|
||||
else:
|
||||
raise GrassEngineException("Could not execute GRASS script {} from {}: {}".format(script, self.get_cwd(), err))
|
||||
|
|
|
@ -25,7 +25,7 @@ geojson==2.3.0
|
|||
gunicorn==19.7.1
|
||||
itypes==1.1.0
|
||||
kombu==4.6.7
|
||||
libsass==0.13.3
|
||||
libsass==0.19.4
|
||||
Markdown==2.6.7
|
||||
olefile==0.44
|
||||
openapi-codec==1.1.7
|
||||
|
@ -41,7 +41,7 @@ pyodm==1.5.3b1
|
|||
pyparsing==2.1.10
|
||||
pytz==2019.3
|
||||
rcssmin==1.0.6
|
||||
redis==2.10.6
|
||||
redis==3.2.0
|
||||
requests-toolbelt==0.9.1
|
||||
requests==2.21.0
|
||||
rfc3987==1.3.7
|
||||
|
@ -57,8 +57,8 @@ webcolors==1.5
|
|||
rio-color==1.0.0
|
||||
rio-cogeo==1.1.8
|
||||
rasterio==1.1.0 ; sys_platform == 'linux' or sys_platform == 'darwin'
|
||||
https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/rasterio-1.1.3-cp38-cp38-win_amd64.whl ; sys_platform == "win32"
|
||||
https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/GDAL-3.0.4-cp38-cp38-win_amd64.whl ; sys_platform == "win32"
|
||||
https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/rasterio-1.1.3-cp37-cp37m-win_amd64.whl ; sys_platform == "win32"
|
||||
https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/GDAL-3.0.4-cp37-cp37m-win_amd64.whl ; sys_platform == "win32"
|
||||
Shapely==1.7.0 ; sys_platform == "win32"
|
||||
waitress==1.4.3 ; sys_platform == "win32"
|
||||
gevent==1.4.0 ; sys_platform == "win32"
|
||||
eventlet==0.25.1 ; sys_platform == "win32"
|
||||
pyopenssl==19.1.0 ; sys_platform == "win32"
|
|
@ -338,6 +338,7 @@ CELERY_WORKER_HIJACK_ROOT_LOGGER = False
|
|||
if platform.system() == "Windows":
|
||||
GDAL_LIBRARY_PATH = ".venv/Lib/site-packages/osgeo/gdal300"
|
||||
GEOS_LIBRARY_PATH = ".venv/Lib/site-packages/shapely/DLLs/geos_c"
|
||||
|
||||
if TESTING:
|
||||
CELERY_TASK_ALWAYS_EAGER = True
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue