I want to calculate the number of vacant lots within 300m from a given building. My source file contains point layers of buildings and vacant lots.

Here's a short description of my workflow. I've successfully completed steps 1 and 2. How do I complete step 3 ?

  1. Create heatmap of vacant lots @300m radius.
  2. Create a layer of contour lines based on the heatmap.
  3. On "buildings" layer, add attribute indicating which contour line each building is located in.
  • Why your buildings layer is points and not polygons?
    – michael
    Commented Sep 14, 2015 at 18:36
  • I converted the buildings layer from polygons to points in order to have the heat-map radius calculated from the centroid. Would it be possible to calculate a heat-map based on an "offset" from a polygon ?
    – Dealec
    Commented Sep 14, 2015 at 19:09
  • 1
    Why convert the vacant lot's to an heatmap? You should simply create a buffer of 300m around the buildings, and then use a Spatial Join calculate how many lot point are with each building buffer. Commented Sep 14, 2015 at 21:24
  • @AlexandreNeto Your suggestion worked for me. If you add it as an answer, I will approve it.
    – Dealec
    Commented Sep 15, 2015 at 13:13
  • @Dealec What Alexander wrote is exactly what I wrote in my answer - With postgis syntax as example (because it's open source and easy)
    – michael
    Commented Sep 15, 2015 at 18:33

2 Answers 2


Why convert the vacant lot's to an heatmap? It's easier than that:

  • Create a buffer of 300m around each buildings (don't use the dissolve option);
  • Use a Spatial Join to determine what lot points are within each building buffer;
  • Use group stats plugin or dissolve, to count, sum, ... the lot point attributes by building.

I suggest different algorithm:

  1. Surround each building with 300m radius circle polygon. If your building is point - it's easy. Else - extract each building to a point at his centroid.

  2. Calculate how much vacant lots exist in each building 300m surrounding polygon. Again if the lot is polygon - Extract it to point at his centroid.

[Usually GIS tools like ArcGis, GM... have build in tool for all this together. Not familiar with QGIS. Usually they plot it as heat map].

In Global Mapper it's Density Grid tool. In QGIS I suggest if possible to work directly with .shp files, store them in PostGis DB (All open source and free) and then just execute PostGis query's (This is what the build in tools in GIS SW doing in the background anyway...). For example (maybe the last select has sql bug, the point is demonstrate the intention...):

    build AS (  --buildings polygons to points
        SELECT ST_Centroid(buildings.geom) AS centroid_geom, buildings.id AS id
        FROM buildings
    lots AS (  --vacant lots polygons to points
        SELECT ST_Centroid(vacant_lots.geom) AS centroid_geom, vacant_lots.id AS id
        FROM vacant_lots
    build_surrounding AS (  --build radius arroung each building
        SELECT id AS id, ST_Buffer(build.centroid_geom, 300)  --Assuming layers in metric units
        FROM build
SELECT sum(ST_Within(lots.centroid_geom, build_surrounding)) AS counter, build_surrounding.id
FROM build_surrounding, lots;
  • 1. All this steps should be made automatically on all the records, not manually so the size of the layers doesn't matter. 2. See my edit to the answer
    – michael
    Commented Sep 14, 2015 at 20:59

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.