5

I have this polygon layer converted to lines, and had the line nodes extracted using Extract nodes. The resulting point layer has several overlapping points because of common borders with adjacent features.

Most of the overlapping points are two points. I want to delete these points that have only 1 overlapping point and those that do not contain any overlapping points.

Select point by number of overlapping features

I was thinking of a workaround which is to select nodes that overlap three or more times so that I could invert select them, then delete the selection (which are the points having only 1 overlapping point or none at all).

How can I select these points that have three or more overlapping points?

  • when you say 'only two overlapping points, which I want deleted', do you mean delete BOTH, or delete only one of them (i.e. do you want to simplify the line, or preserve intermediate nodes but remove duplicates, as if you were using TopoJSON)? – Steven Kay Aug 26 '18 at 9:05
  • 1
    @Steven Kay: I want to delete both points (so that only three or more overlapping points are left on the map). – JAT86 Aug 27 '18 at 0:20
3

Going by your last sentence, here is how I would identify "... three or more overlapping points":

  1. Start editing your point layer's attribute table and create a new text field, 50 characters long. Let's call this field text_x_y. This new field will contain the x,y coordinates (using the layer's coordinate reference system units of measure) for each point. Using the QGIS Field Calculator, input the following expression for text_x_y, which will concatenate the x,y coordinates, separated by an ampersand:

$x || ' & ' || $y

The resulting text_x_y attribute values will look something like:

-67793.1195668855 & 1095317.35465502

and so forth...

In this case the x,y values are in meters. The ampersand is not required, but helps me visualize x and y.

Save the edits and stop editing.

  1. Overlapping points will now have the same text_x_y value. Count the number of overlaps using the QGIS Processing > Toolbox > QGIS Geoalgorithms > Vector Table Tools > Frequency Analysis tool. The point layer is the Input, and text_x_y is the Field. Output the frequency results to a .csv file.

The output .csv file will contain two fields, text_x_y and FREQ, where FREQ is the number of overlaps.

  1. Open the original point layer's attribute table. Then open its properties window and set up a join. The Join Layer is the output .csv file from step #2. The Join Field is text_x_y from the output .csv file. The Target Field is text_x_y from the source point file.

With the join in place, you'll see that FREQ has been added to the point layer's attribute table. Select those records where FREQ >= 3. Voila!

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.