In QGIS install the plugin debugvs
.
The debugvs
plugin needs the python module ptvsd
to function. This module is not installed by default.
In principle you just pip install ptvsd
in the python interpreter used by QGIS.
In QGIS install the plugin debugvs
.
The debugvs
plugin needs the python module ptvsd
to function. This module is not installed by default.
In principle you just pip install ptvsd
in the python interpreter used by QGIS.
-- plpython needs to be enabled. Furthermore scipy needs to be installed in the python used. | |
-- CREATE LANGUAGE plpythonu; | |
CREATE OR REPLACE FUNCTION septima.voronoi(geom geometry, boundingpointdistance double precision) | |
RETURNS SETOF geometry_dump AS | |
$BODY$ | |
from scipy.spatial import Voronoi | |
import numpy | |
class GeoVoronoi: |
This is how I debug QGIS using VSCode on OSX. Previously I used this approach. But since then ptvsd
was deprecated and I also needed to install python modules backed by native C code. This is much easier to do in a conda based environment (actually, I didn't find a way to make it work with the official QGIS installer :-)).
Follow this description to get QGIS running in conda.
ptvsd is superseded by debugpy.
Acti
Install Anaconda or Miniconda from here https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html
Create a conda environment in which you will install QGIS. In this example we call it conda_qgis
.
> conda create -n conda_qgis
> conda activate conda_qgis
Install modified rasterstats from https://github.com/AsgerPetersen/python-rasterstats/tree/boundless to use this script as is.
Or just modify the bool in this line https://github.com/perrygeo/python-rasterstats/blob/master/src/rasterstats/io.py#L319
Script output:
❯ time python test.py
Using boundless: True
python test.py 72.11s user 9.82s system 99% cpu 1:21.96 total
Based heavily on this old guide by TimLinux http://linfiniti.com/2012/09/remote-debugging-qgis-plugins-using-pycharm/
import sys
sys.path.append('/Applications/PyCharm.app/Contents/debug-eggs/pycharm-debug.egg')
from math import log, ceil, sqrt | |
# Gennemsnitlig stoerrelse af en tile. 25kB passer nogenlunde med ortofoto | |
size_per_tile = 25 * 1024 # 25kB | |
# --------GSTs standard skema --------------- | |
# Koordinater paa tilet omraade (xmin, ymin, xmax, ymax) | |
#bbox = [120000, 5900000, 1000000, 6500000] |
""" | |
Zonal Statistics | |
Vector-Raster Analysis | |
Copyright 2013 Matthew Perry | |
Changes by AsgerPetersen: | |
- Use band nodata value if user does not override it | |
- Allow calculating statistics for all geometry types | |
- Allow buffer to be applied before calculation |
Wedge buffers in python
Copyright (c) 2016, Asger Sigurd Skovbo Petersen
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF