1

If I have a vector of polygons A (say 200) and want to create a new vector (say 120) of the original 200 polygons that are with 500m of a vector of points P (say 50), this is the method I do. I want to know if there is a simpler way

1.) Add calculated field to A called "rownum" with expression $rownum to create an ID field for the polygons

2.) Create buffer vector B of original 200 polygons from A with a 500m radius

3.) Do a spatial query which does

   source     : B
   operator   : INTERSECTS
   references : P

this will highlight and select 120 records from B. hit close

4.) Right click on B, save as, "save features selected only" is ticked, and save as B2. this now contain just the 120 buffers

5.) Double click A, goto JOIN, and add join to B2 on rownum column added in 1 (seems to do left join still 200 results)

6.) Open attributes for A and add filter by expression "where B2_dummy is not null" (this makes the join effectively an inner join). This will select the 120 rows. close attribute table

7.) Right click A, save as, "save features selected only" is ticked, and save as A2. this now contain just the 120 polygon records from A that were within 500 metres of a point in P

Is there a simpler / better way to do this?

1 Answer 1

3

Simply rethink your buffers and avoid all that joining malarkey:

  1. create buffer vector Pbuf of 50 points with a 500m radius
  2. do a spatial query which does

    select features from: A
    operator : INTERSECTS
    by comparing to: Pbuf

  3. Save selected features in A as A2

You can always create the unique ids if you want to refer back to the original A dataset but it is not a required step if you just want the polygons and original attributes.

2
  • thanks makes sense i knew i had it ass about. Funny thing is when i do it this way two of my features from A, no longer match the within 500m. these are border line cases, that are perfectly or near to this distance away.
    – Ab Bennett
    Commented Dec 29, 2018 at 13:18
  • When it creates the buffers they are actually, strictly speaking, approximations of circles as it is not using arcs and that will be where the discrepancy lies - the difference between buffering a single point and multiple vertices in a polygon. If you want to increase the accuracy of a buffer, push up the 'segments' value in the buffer tool. This will densify the vertices and therefore reduce the 'flat-spots' between the vertices that approximate the circle (making the buffer more circular). Greater accuracy comes at the expense of increased data volume but for 50 points it's not an issue. Commented Dec 29, 2018 at 16:57

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.