point = QgsGeometry.fromPointXY(QgsPointXY(76.526886, 12.952560)) polygon = QgsGeometry.fromWkt("POLYGON((76.529311 12.953874,76.528771 12.951488,76.525803 12.951694,76.526478 12.953888,76.529311 12.953874))") if point.intersects(polygon): print("Point intersects with Polygon") else: print("Point does not intersect with Polygon")
line1 = QgsGeometry.fromWkt("LINESTRING(10 10, 50 50)") line2 = QgsGeometry.fromWkt("LINESTRING(20 40, 40 20)") if line1.intersects(line2): print("Lines intersect") else: print("Lines do not intersect")Package library: qgis.core