3

I have a QGIS plan which shows ponds (as points in a shape file with an OS tile as a background) within a survey area. I need to calculate the total number of ponds within 1 km of each of the on-site ponds individually.

I have created one layer with 1 km buffers for each pond as a shapefile.

As there are many ponds, this is messy to look at and I would like to create a layer which has the outline of all of the 1 km buffers combined. I have tried selecting the layer with the buffers and vector-geoprocessing tools - dissolve, but the new layer had outlines for each individual buffer.

Question part 1 - how do you create combined buffers, or convert existing buffers into one?

I will then use this outline to manually check the OS plan and add points representing ponds as a new layer "off site ponds".

Question part 2 - How would I then find the number of ponds (onsite and offsite, not counting the pond being queried) within 1 km of each on-site pond (individually).

Sub-question - if one of the buffers dissects a symbol for a pond will it count the pond, or only if the centre point falls within the buffer? (i.e. could the size of the symbol affect the result?)

2 Answers 2

6

Question part 1 - how do you create combined buffers, or convert existing buffers into one?

I don't know what version of QGIS you are using, or whether this feature is missing in older versions, but the Buffer tool has an option to "Dissolve buffer results". Note the pointer position in the following image:

QGIS Buffer Tool

Note that because my data are different, I've set the buffer distance to 200 m. You should set yours to 1609 m = 1 mile.

Question part 2 - How would I then find the number of ponds (onsite and offsite, not counting the pond being queried) within 1 km of each on-site pond (individually).

While you may want to dissolve buffers for visual display, you cannot use dissolved buffers to answer this question, since it sounds like you want a count for each pond separately. So even though the buffers overlap, that is OK, since a pond could fall in the search radius of more than one onsite pond, and you want it to count for each. Use Vector→Analysis Tools→Points in polygon:

QGIS Points-in-Polygon Tool

Since each buffer was constructed from a point, to get the count of ponds not including the central pond, use the Field Calculator tool to update the pond_count field to pond_count less one. Open the attribute table and click the "Toggle editing mode" button in the upper left. Then click the "Open Field Calculator" button in the upper right. Check "Update existing field", set the field to pond_count, and in the Expression box enter pond_count - 1:

QGIS: Updating an existing field with the Field Calculator

Hit OK once only, and close the dialog. Save your edits and toggle editing off.

If the ponds have some kind of unique identifier, it should propagate through each step of the process to your final shapefile, which will be a polygon layer of buffers with the count of all ponds within a 1 mile radius.

Sub-question - if one of the buffers dissects a symbol for a pond will it count the pond, or only if the centre point falls within the buffer? (i.e. could the size of the symbol affect the result?)

QGIS and other GISes treat points as a mathematical point (i.e., infinitesimally small). The size of the symbol you use to visualize your data is irrelevant to the calculation. Some spatial query operations may have different results depending on whether a point falls exactly on a polygon boundary (in general GIS terminology, the difference between "contains" and "contains completely"), but I'm pretty sure the QGIS Points-in-Polygon tool will count a point on the edge as being within the polygon. I haven't tested it though. It's unlikely to make a difference in this dataset. It's more likely to be important in a situation where points and polygons are constructed on some common base, such as a street grid, and you need to decide what to do with points that fall at the exact boundary between two neighboring polygons.

0
2

For question 1 use the Dissolve tool. By default it puts in one of your existing field names for Dissolve field. You have to change that to Dissolve all so that all touching features will dissolve, see caption below:

enter image description here

For question 2 you may use Multipart to singleparts tool to split the multipart polygons apart, then run the Join attribute by location tool to get a count of how many pond/point feature intersect each buffer polygon, see caption below for Join attribute by location tool.

enter image description here

6
  • thank you - I had tried dissolve early on, but perhaps without the dissolve all, this works perfectly.
    – Jo Pedder
    Commented Dec 13, 2013 at 16:22
  • @Gerald and artwork21. Thank you for you help. For Question 2, your suggestion works well. I can select each buffer in turn and use spatial query for the layer with the on-site ponds and the layer with the off site ponds, then add the two. There are some 26 ponds, so this would take 52 queries. Is there another way to run the query once and get the count from two layers for each buffer separately? - even if I just had to run it twice, once for each layer that would be useful.
    – Jo Pedder
    Commented Dec 13, 2013 at 16:52
  • @Jo Pedder, See my update answer.
    – artwork21
    Commented Dec 13, 2013 at 17:40
  • ok, I've now tried this. When following as per your direction, I end up with a new shapefile which appears blank. I have used the layer "onsite pond buffer" as the target vector layer and the layer "ponds" as the join vector layer. If I re-run selecting keep all records, I get all the pond references, but NULL results for SUM. This must mean that QGIS doesn't think that there pond points within those buffers (but there are plenty).
    – Jo Pedder
    Commented Dec 13, 2013 at 20:26
  • Blank shapefile, after what step?
    – artwork21
    Commented Dec 13, 2013 at 20:28

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.