I need to do the following in QGIS and hope so much anyone could help.

I have a vector layer with points. Each point represents a firm with the number of employees in the attribute table. I want to buffer around every point, so that the buffer's attribute table contains the sum of employees within the buffer.

It would be so great if the sum to each point could be written to the attribute table.

Thanks for your help.

  • Do any of the buffer polygons overlap?
    – user3461
    Jul 20, 2013 at 18:37
  • Hi Kevin - yes they do overlap!
    – Matthias
    Jul 20, 2013 at 19:09

1 Answer 1


If you want to import your points into SpatiaLite, it's easy to get the total number of employees in each buffer. Suppose we have a point table "firms" in spatialite with columns "firm_name" and "num_employees". Assuming you want buffers of size 5000, then

First create the buffer polygons table:

firm_name TEXT, ttl_employees INTEGER;
SELECT AddGeometryColumn('firm_buffers','geometry',<your SRID>,'POLYGON','XY');

Now create the buffer polygons:

INSERT INTO firm_buffers (firm_name, geometry)
SELECT firm_name, ST_Buffer(geometry, 5000) FROM firms;

Now update the ttl_employees column:

UPDATE firm_buffers SET ttl_employees=(
SELECT SUM(f.num_employees) FROM firms AS f
WHERE ST_Contains(firm_buffer.geometry, f.geometry));

That should total up all employees from all firm locations with a buffer.


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.