I have two line layers assume A and B and each layer contains multiple features. I have selected one feature in layer A, by using that I need to find nearest nodes of a features in layer B .
I tried this
for rfeat in LayerA.selectedFeatures():
rgeom = rfeat.geometry()
geom_buffer = rgeom.buffer(50, -1)
for feats in LayerB.getFeatures():
sgeom = feats.geometry()
if sgeom.intersects(geom_buffer ) :
print(feats["id"])
but I am getting all features in layerB.