-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute.py
More file actions
35 lines (30 loc) · 886 Bytes
/
execute.py
File metadata and controls
35 lines (30 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import time
from qgis.core import *
import dotenv
dotenv.load_dotenv()
# init qgis
QgsApplication.setPrefixPath(os.getenv('QGIS_PREFIX_PATH'), True)
qgs = QgsApplication([], True)
qgs.initQgis()
# loading main code
import os
import sys
modules_path = os.getcwd()
if sys.platform == 'win32':
modules_path = modules_path.replace('\\', '\\\\')
sys.path.append(modules_path+'/functions')
print('loaded modules from: ', modules_path)
from main import main
print('-----------------------------------------')
print(' starting execution')
print('-----------------------------------------')
time_start = time.time()
main()
time_end = time.time()
execution_time = time_end - time_start
print('-----------------------------------------')
print('execution time: ', execution_time, '[s]')
print('-----------------------------------------')
# closgin qgis
qgs.exitQgis()