I need to find distance in eastward direction from each point to the closest polygon edge:
I can find shortest distance in any direction with:
pointlayer = QgsProject.instance().mapLayersByName('points_inter_squares') points = [[f.geometry(),f['Ruta_100km']] for f in pointlayer.getFeatures()] squarelayer = QgsProject.instance().mapLayersByName('squares') squares = [[f.geometry(),f['Ruta_100km']] for f in squarelayer.getFeatures()] for point in points: print(min([QgsGeometry.distance(point,square) for square in squares if point!=square])) >>12639.380321901293 >>3320.150455611874 >>6650.862023710273 >>2452.079442886869
'Ruta_100km' is the Squares IDs, so I measure distance to all Squares but the one intersecting the Points.
Is there a method where I can specify direction when measuring distance?