11

This is probably a naive question but I am struggling as a new user to QGIS.

I have a very large shapefile (275,000 points, but can break this into about 10 subregions if necessary for faster processing).

I want to identify all points that have no other point within 200 metres and then code each of those points with the value "unique" in a field of the file.

For all the other points that are part of local clusters I then want to code those as "clustered".

Having achieved that, I want to then select just one for each cluster on a random basis to retain in the data set, discarding the others.

Currently I am failing to achieve step 1 so any assistance would be welcome.

0

You could also try a self join using the NNJoin plugin in QGIS.

For each feature of the input layer it will find the closest feature (excluding itself in case of a self join) and include the distance and all the attributes of the closest feature in the generated dataset. It would take some time for your dataset (I tried with a point dataset with about 175000 features, and that takes some minutes...).

9

You can use Vector > Analysis Tools > Distance Matrix, and a join to achieve what you ask.

I will use qgis sample data airport's layer to exemplify. This is a small dataset so I'm not sure how it will go with a 275000 points shapefile.

1. Create a distance matrix using your layer as both destination and target.

Don't forget to tick "Use only the nearest (k) target points" and set it to 1.

enter image description here

2. Open the CSV with add delimited text layer

Choose "Comma" as a delimiter, and set the geometry definition as no Geometry

enter image description here

3. Create a join in the original layer with the newly created table

enter image description here

4. Use Field calculator to populate a field with the desired values

Because of the join, we now have access to the distance table values from within the airports table of attributes, therefore it quite fairly easy to create a new field and populate it with "clustered" and "unique" values depending on the distance matrix values. because of my example data I have used the value 1200000 (1200 km), you should adapt it to your case (200).

enter image description here

In the end your layer should have a new field called point_type with different values according to the minimum distance to the nearest point.

enter image description here

  • That looks like an elegant solution. However I have one complication. I know there are some points that have IDENTICAL locations (these result from name synonyms during original data capture). In one case I identified 3 on the same point. I think your solution assumes (sensibly) that all points are uniquely located. Is there some obvious way I can screen my coverage to eliminate same-location points first? – Leigh Bettenay Oct 6 '14 at 0:01
  • @LeighBettenay If this answer addresses your original question then I think you should accept (green tick) it, to reward the answerers effort, and research/pose your additional requirement as a new question. +1 for a great first question! – PolyGeo Oct 6 '14 at 8:07
  • @PolyGeo Sorry I'm brand new to this forum and don't know the protocol. Happy to "green tick" a wonderful answer but sadly don't know how!! – Leigh Bettenay Oct 7 '14 at 13:03
  • Just click the gray tick mark below the voting of the question (to-left corner of the question). Thanks – Alexandre Neto Oct 7 '14 at 13:22

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.