I am using PyQGIS. What is the difference between:
QgsGeometry.fromPointXY(QgsPointXY(x, y))
QgsPointXY(x, y)
QgsPoint(x, y)
When I print these three options, I get:
print(QgsGeometry.fromPointXY(QgsPointXY(x1, y1)))
<QgsGeometry: Point (59777 -266560)>
print(QgsPointXY(x1, y1))
<QgsPointXY: POINT(59777 -266560)>
print(QgsPoint(x1, y1))
<QgsPoint: Point (59777 -266560)>
(x1,y1)
are specific coordinates that I used as a test.
I don't understand the difference between these objects, and I need to know because there are some methods that work only in one or two of them. For example, the intersect
method does not work for QgsPoint
(at least it didn't work when I tried to check which feature the point intersected with).