0

Using QGIS 3.4

I have a set of points and I am using the atlas tool to generate reports for each point.

I'm looking for a way to only create reports for points that intersect a polygon.

These polygons change all the time, so im looking for a more on the fly way to filter these points, rather than the traditional select and save as a new layer.

In the atlas tools I see there is a "filter with" option and it gives you the ability to write an expression.

How can I create an expression/function to do the filter.

  • Do you have only one polygon, or multiple polygons? Are the polygons all in one layer? – csk Jun 25 at 19:36
2

To filter the atlas features based on intersection with a single polygon, use this expression in the atlas filter, with substitutions as explained below:

 intersects( $geometry, geometry(get_feature('polygon_layer','attribute','value')))
  • substitute the name of your polygon layer for 'polygon_layer'
  • substitute the name of an attribute in your polygon layer for 'attribute'
  • substitute the value of that attribute for the appropriate polygon for 'value'

To filter the atlas features based on intersection with multiple polygons, use this expression in the atlas filter, with substitutions as explained above:

intersects( $geometry , aggregate( 'polygon_layer', 'collect', $geometry))
  • is that on the layer in question, or in the atlas filter expression? – DPSSpatial Jun 25 at 22:40
  • @DPSSpatial use the expressions in the atlas filter expression. Also, I fixed a mistake in the expressions, so if you tried them before and they didn't work, try them again. I replaced @atlas_geometry with $geometry. – csk Jun 27 at 16:42
  • thanks! I hadn't thought about using them in the atlas filter. – DPSSpatial Jun 27 at 17:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.