Fixed locale complaints from GRASS

pull/1156/head
Piero Toffanin 2020-09-17 14:03:17 +00:00
rodzic 3f133309aa
commit 3f4f05f639
2 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -23,7 +23,7 @@ i.cutlinesmod.py --overwrite input=ortho output=cutline number_lines=${number_li
v.select ainput=cutline binput=crop_area output=result operator=within
# Export
v.out.ogr input=result output="result.gpkg" format=GPKG
v.out.ogr input=result output="result.gpkg" format=GPKG --overwrite
# Merge all geometries, select only the largest one (remove islands)
ogr2ogr -f GPKG -overwrite -explodecollections -dialect SQLite -sql "SELECT ST_Union(geom) FROM result ORDER BY ST_AREA(geom) DESC LIMIT 1" cutline.gpkg result.gpkg

Wyświetl plik

@ -6,6 +6,7 @@ import sys
import time
from opendm import log
from opendm import system
import locale
from string import Template
@ -94,7 +95,8 @@ class GrassContext:
log.ODM_INFO("Executing grass script from {}: {} --tmp-location {} --exec bash script.sh".format(self.get_cwd(), self.grass_binary, self.location))
env = os.environ.copy()
env["GRASS_ADDON_PATH"] = env.get("GRASS_ADDON_PATH", "") + os.path.abspath(os.path.join("opendm/grass/addons"))
env["LC_ALL"] = locale.getdefaultlocale()[1] or "C.UTF-8"
filename = os.path.join(self.get_cwd(), 'output.log')
with open(filename, 'wb') as writer, open(filename, 'rb', 1) as reader:
p = subprocess.Popen([self.grass_binary, '--tmp-location', self.location, '--exec', 'bash', 'script.sh'],