QGIS is a widely used, free and open source, GIS software package. This is an update on how to use it with PyScripter. I have used the currently latest version for Windows (3.42) but you can adapt the instructions to other recent versions of QGIS.
Create a command file "PyScripter-QGIS.cmd" with the following content:
@echo off
rem Adapt the following line to match your installation
set QGIS_ROOT=C:\Program Files\QGIS 3.42.0
call "%QGIS_ROOT%\bin\o4w_env.bat"
path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%
@echo on
rem Set VSI cache to be used as buffer, see #6448
set VSI_CACHE=TRUE
set VSI_CACHE_SIZE=1000000
set GDAL_FILENAME_IS_UTF8=YES
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt5\plugins
set PYTHONPATH=%QGIS_ROOT%\apps\qgis\python;%PYTHONPATH%
pushd "c:\Program Files\PyScripter"
rem Adapt the following line to match the python version that comes with QGIS
start "PyScripter" /B "PyScripter.exe" --PYTHON312 --PYTHONDLLPATH="%QGIS_ROOT%\apps\Python312"
popd
Save it anywhere you want and run it.
Then in the PyScripter python interpreter you can do:
*** Python 3.12.9 (main, Feb 7 2025, 14:34:44) [MSC v.1938 64 bit (AMD64)] on win32. ***
*** Remote Python engine is active ***
>>> from qgis.core import *
>>> import qgis.utils
>>> from PyQt5.QtCore import QSettings
>>>
That's it.
No comments:
Post a Comment