How do I filter out points that lie in the water or outside specified polygons?

For example I want to filter out the erroneous points in the oceans in one project, and filter out all points not in the green polygons in another project. I only know how to filter an attribute table by column and sorting using words, not sorting using shapes

enter image description here

  • Easiest way - for display only - is to do a select by location on the points and polygons, invert the selection, copy and paste the selected features to a temporary scratch layer. This won't update if your data updates. Otherwise you'll need to create a new column on your point dataset and add a '1' to indicate if it intersects polygons or not, then simply symbolize your data on that column Aug 22, 2019 at 22:36
  • Can you write out how to do all that as an answer to this question
    – QGISer
    Aug 22, 2019 at 23:06
  • 2
    there are plenty of other questions about how to use that tool on this forum and elsewhere online, so there's not much point. Aug 23, 2019 at 0:12
  • Can you link to them
    – QGISer
    Aug 23, 2019 at 0:28

2 Answers 2


To keep only the points that are in the green layer, find the Select by location tool in the Processing Toolbox. Use the Select by location tool with the following settings:

  • Select features from point layer
  • Where the features (geometry predicate) intersect
  • By comparing to the features from polygon layer

enter image description here

Now you have selected all the points that fall inside the polygon layer. Export the selection as a new layer (Right click on point layer in layer panel > Export > Save Selected Features as...).


If you just want to hide points for visual purposes and don't want to create a new shapefile:

  1. Follow the instructions in ahmadhanb's answer to select all points which intersect your polygon.
  2. Open field calculator for of your point layer. Ensure the 'Only update xx selected features' box is ticked. Create a new field named "Filter". Field type can be integer. Insert 1 into the expression box and click OK.
  3. Save edits to the point layer and open the layer properties.
  4. In the 'Source' tab, click 'Query builder' in the bottom right corner.
  5. To hide all points within the polygon, enter the filter expression "Filter" IS NULL and click OK. Conversely. to hide all points outside the polygon, enter the expression "Filter" = '1'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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