Skip to content

Instantly share code, notes, and snippets.

@agiudiceandrea
Created July 15, 2021 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agiudiceandrea/5d82873569d8c4e920b0516c0249c51f to your computer and use it in GitHub Desktop.
Save agiudiceandrea/5d82873569d8c4e920b0516c0249c51f to your computer and use it in GitHub Desktop.
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
def raggio_cerchio(qPt1, qPt2, qPt3, feature, parent):
"""
Calcola il raggio del cerchio passante per tre punti.
"""
pt1 = QgsPoint(qPt1.asPoint())
pt2 = QgsPoint(qPt2.asPoint())
pt3 = QgsPoint(qPt3.asPoint())
raggio = QgsGeometryUtils.circleCenterRadius(pt1, pt2, pt3)[0]
if raggio == -1:
raggio = None
return raggio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment