66

I'm using QGIS 1.8 with a PostGIS database and I have three PostGIS layers in QGISL: a lines, a points, and a polygon.

I'm trying to select features in the polygon layer and mark all points within this polygon.

For me the only way to do this is to use the button "Select by Polygon" but in this way, I cannot use an existing polygon for selection.

2

2 Answers 2

79

Two possible solutions:

  1. You can use the "Select by Location" from Vector > Research tools > Select by Location and tick the "Use selected features only" checkbox.
  2. If you want to actually export the points which intersect your selected polygon to a new shapefile then "Intersection" from Vector > Geopressing tools > Intersection and again tick the "Use only selected features" checkbox. The input layer will be your points layer, and the select layer will be your polygon layer.
5
  • Furthermore, am I correct in adding that for the Vector processing to work, the following two conditions need to be met: [1.] The layers need to have the same CRS; and [2.] The layer needs to be selected in the 'Layers' panel.
    – Gonja
    Apr 5, 2016 at 14:26
  • 1
    I do not have "Use only selected features" checkbox, see dropbox.com/s/hw2d422gh6wmoxm/… ? I have 2 layers, selected, and an object selected in one of the layers.
    – JaakL
    Apr 18, 2017 at 8:43
  • 2
    Take care when the layers are too large - they must be loaded into QGIS as a whole, which may be slow. It may be better to use a PostGIS query (e. g. via the DB Manager) instead. Jan 22, 2018 at 8:49
  • @JaakL I had the same problem, but as you can see in the response below, the default behavior is to use the selected features if any: gis.stackexchange.com/a/257060/121285
    – nanocv
    Sep 17, 2018 at 11:19
  • The intersect tool works so-so in edge/boundary conditions, I would suggest trying the Select Within plugin suggested below Nov 10, 2018 at 3:07
4

I can suggest using the Select Within Plugin.

Centroid within, point of surface within, pole of inaccessibility within, percentage within, and mostly within selection. Works best with lines and polygons, but should work with other geometries as well.

window

1
  • Yes!!! Tried this tool once & it nailed it. Select by centroid is the behavior I would expect from the default QGIS Select by Location tool, which did not perform very well on edge and boundary conditions. Nov 10, 2018 at 3:06

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