Created
July 15, 2021 10:10
-
-
Save agiudiceandrea/5d82873569d8c4e920b0516c0249c51f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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