I have two layers in QGIS. One WMS raster layer with a country map and one layer with points. It looks like this: enter image description here

I want to remove all the points that lie outside the contours of the country map, so I can just keep the points that lies inside the country. How can I do this easier than removing all the points one by one?

  • is there a WFS server associated with the WMS?
    – Ian Turton
    Commented Mar 4, 2018 at 17:09

2 Answers 2


As described below, you can select points in or out of your contour by Spatial Query.

  1. On your country layer where you have contours, click on the outermost contour to select.
  2. Open the menu Vector | Spatial Query | Spatial Query
  3. It will open the Spatial Query window.
  4. Select source features from: Your points
  5. Where the feature: Within
  6. Reference features of: Your polygon (Contour) - Selected geometries
  7. And use the result to: Create new selection
  8. Click on Apply
  9. You will see Result feature ID's lists selected points.
  10. Close to close this window.
  11. Open the Attribute table of your points layer. Selected points will be highlighted.
  12. Click on Invert selection icon or Ctrl+R.
  13. Enter Edit mode (pencil icon) and Delete selected features.


Step 0. Please create a polygon layer which follows the contour (is it a country boarderline, perhaps?) by digitizing.

  • 1
    There won't be a contour though, the WMS (country layer) is an image
    – nmtoken
    Commented Mar 4, 2018 at 5:07
  • ack, then the contour in the question is...oh... thanks @nmtoken !
    – Kazuhito
    Commented Mar 4, 2018 at 5:16
  • I dont have a polygon now, but a line. Lets say its a coastline. How can I then delete all the points to the right of the line? Commented Jun 23, 2018 at 23:44
  • @LarsFredrik um...I probably do not understand the context. Could you post a new question, perhaps? Thanks :)
    – Kazuhito
    Commented Jun 24, 2018 at 0:26

Looking back (received comment from nmtoken), I found I have completely misunderstood the question.

enter image description here

QGIS toolbar has a Select Feature(s) tool. When you click on small black triangle, it opens a drop-down menu. You will see Select Features by Freehand.

Now you can draw the selection polygon following the contour line you see on the WMS background image. These selected points can, of course, be deleted at once.

  • Thanks. Maybe what caused the confusion was because I didnt mention it was a WMS layer at first, but edited the text later. Maybe its better to find another layer that is not WMS and have a contour? Commented Mar 4, 2018 at 13:06
  • @LarsFredrik Thanks, and sorry, it was just my mistake. Yes, if you can find a polygon contour layer, it will be definitely useful to define the area to choose / exclude points.
    – Kazuhito
    Commented Mar 4, 2018 at 22:51

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.