How to configure PyQGIS development environment

preview_player
Показать описание
If you are interested in me, you can find me from Skype: 3DGISKing.

bat file content:
SET OSGEO4W_ROOT=C:\Program Files (x86)\QGIS 2.18
SET QGISNAME=qgis-ltr
SET QGIS=%OSGEO4W_ROOT%\apps\%QGISNAME%
SET QGIS_PREFIX_PATH=%QGIS%


SET PATH=%PATH%;%QGIS%\bin
SET PYTHONPATH=%QGIS%\python;%PYTHONPATH%

start "PyCharm aware of QGIS" /B %PYCHARM% %*

import os, sys

canvas = QgsMapCanvas()

source_dir = "C:/qgis_sample_data/shapefiles"

# load only the shapefiles
vlayer = QgsVectorLayer(source_dir + "/" + files, files, "ogr")

# add layer to the registry

# set extent to the extent of our layer

# set the map canvas layer set

# refresh canvas and show it

Рекомендации по теме