It seems evaluation of @atlas_geometry is always 'null'

test code:

exp = QgsExpression('if(@atlas_geometry is null,1,0)') // always returns 1
rq = QgsFeatureRequest(exp)

@atlas_geometry within layer's expressions seems work fine though.

I have to do double spatial filtering across two layers so I come up with writing a predicate in PyQGIS for using in layer expression. Unfortunately it seems @atlas_geometry always returns null in my python code, despite it works fine in layer expression.

Can I access @atlas_geometry in my python code as if it's in layer's expression?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.