Executing Python scripts |
![]() ![]() ![]() ![]() |
The possibilities of GIS for spatial data analysis, automation of the processes of creating and updating digital terrain models can be expanded by including python scripts into the software, which can be written in any text editor. Choice of the script onto execution is made in the Run applications dialog in the Scripts bookmark.
The toolbar includes the following modes:
The bottom of the script list displays the name of the current script file, the name of the function that will be called from the file, and the name of the script editing program that the user has selected on own computer. Buttons can be used to select an editing program:
In the script tree there is initially set a node the Basic script set, which contains the scripts that are installed with the GIS. To connect user scripts, it is advisable to create your own node (theme) so that when the GIS distribution kit is updated, new scripts are saved in the tree. The basic set of scripts demonstrates the execution of various procedures for processing the coordinates and attributes of vector map objects, solving computational tasks, converting data and other tasks.
To search for a script by name, you must press the key combination CTRL+F and enter the search string.
To execute scripts, you must first download and install the python interpreter. The basic set of scripts was developed and tested based on python version 3.7.9 on OS MS Windows 7 and version 3.10.5 on MS Windows 10 and MS Windows 11. When any script is run for the first time, python version 3.10.5 is automatically searched (cannot be installed on MS Windows 7), and then version 3.7.9 (works on any version of MS Windows). Basic scripts are located in a shared folder like: c:\Users\Public\Documents\Panorama\py_base14\. The list of scripts is stored in c:\Users\Public\Documents\Panorama\py_base14\pylist.xml file. The list of scripts added by the user is stored in the file - c:\Users\username\AppData\Roaming\Panorama\pylist.xml.
Development of scripts can be performed using MAPAPI functions. The function prototypes are declared as imported python scripts from the c:\Users\Public\Documents\Panorama\py_mapapi14\ folder. For proper processing of script strings containing national characters (Russian, Chinese, Spanish, and so on), the scripts must be encoded in UTF-8.
Development of scripts in python and MAPAPI Recommended python script structure Processing semantics (attributes) of objects in python Creating and selecting lists of objects on the map Displaying the results of script execution Class for processing selected objects Executing calculations by the road graph Executing multithreaded scripts Diagnostic messages when executing the script Running a script in debugging mode
|