Skip to content
AI Segmentation
QGIS
Tutorial

How to Detect Building Footprints in QGIS Automatically

0:00 / 0:00
One zone, one word, 848 buildings. Real run, sped up 3x, nothing cut.

I ran automatic detection over a zone of central Paris and got 635 polygons back in one pass. Deciding which 82 to keep took longer than the detection did, and that second part is what almost every tutorial leaves out.

Dense Parisian city blocks before and after automatic building detection (after)
Dense Parisian city blocks before and after automatic building detection (before)
ImageryDetected
Drag to compare
One automatic pass over central Paris, on Google Satellite imagery. Every polygon gets its own colour so neighbours stay separate. Drag the handle to compare.

The short version. To detect building footprints in automatically: install an AI detection plugin from the plugin manager, load your imagery, draw a zone, name the object, run it. You get a polygon layer in your project CRS. Then filter that raw output by confidence and area, because a large share of what comes back is not a building.

What a building footprint is

The outline of a building where it meets the ground, as a flat polygon. Not the roof, not the parcel, not the address point.

Which matters here, because vertical imagery gives you the roof. On a five-storey Haussmann block shot near-nadir the offset is small. On a tower it is not. Worth knowing before you promise anyone a footprint layer.

Check the open datasets first

For a lot of jobs you don't need to detect anything.

Three panels of the same dense Luanda neighbourhood on Google Satellite imagery, with building footprints in green. OpenStreetMap shows none, Microsoft covers most, Google Open Buildings covers nearly all.
The same 1 km² of Luanda, on Google Satellite imagery. OpenStreetMap maps no buildings here, Microsoft finds 3,140, Google Open Buildings 4,468. Over a dense African neighbourhood the dataset you reach for decides whether you get everything or nothing.

Load one against your imagery. You only move on when the coverage has holes, the vintage is wrong, or the footprints have to match the specific orthophoto a client handed you.

Under fifty buildings, draw them

Digitize by hand. Free, exact, and I'd still do it myself at that size. Turn on snapping first (Project -> Snapping Options, vertex and segment, topological editing on) or you'll spend the afternoon deleting slivers.

Around the 60th building you start cutting corners you'd never have cut on the 6th, and you don't notice. It's already in the layer.

The automatic way

The plugin here is AI Segmentation, which my co-founder and I build at TerraLab, so read this section knowing whose tool it is. It installs from the plugin manager like any other: no download by hand, no Python environment, no dedicated graphics card, because the model runs on our servers. Windows, macOS and Linux.

Draw a zone, type buildings, hit Detect. That's the whole prompt, in your own language if you prefer. Results stream back tile by tile as one polygon layer in the project CRS.

The AI Segmentation panel in QGIS with the Semi-Auto and Automatic switch
Automatic mode: pick the imagery layer, draw a zone, name the object.

The one setting worth learning is precision, which is the tile size. Small tiles give the model a close look, which small objects need. Big tiles give it context, which a farm parcel needs. Tiles are also what you pay for: one credit each. Every account gets a free allowance each month, no card asked for, and Pro raises it. Detection runs on European servers, we do not train on your imagery, and there is a small local model if nothing may leave your machine.

Then the panel walks you through three steps before anything becomes a layer: filter what to Keep, Correct what the model missed, and choose the output Shapes. The complete guide covers all three. The first one is where the job is won, so it gets the next section.

Filtering is the whole job

Raw detection output is a set of candidate polygons with confidence scores. On dense imagery most are small and uncertain. I exported this Paris run with both filters wide open, so every candidate landed in the layer: 635 polygons over 1.18 km².

1 m²101001 00010 000 m²50 m²
Every one of the 635 detections, binned by area on a log scale. Two humps: noise under 5 m², real buildings above 160 m². The 50 m² line falls in the valley between them, which is why it is not an arbitrary number. Median 3.2 m², largest 13,528 m², median confidence 0.26.

Half of what came back is smaller than a parking space: vents, skylights, stairwell housings, courtyard sheds. Real things on the imagery, correctly outlined, and not what anyone means by a building footprint.

So filter. Move the two sliders in the panel, or do the same job from the attribute table with Select by Expression:

"area_m2" >= 50 AND "score" >= 0.5

That leaves 82 polygons out of 635, covering 222,338 m² of the 263,658 m² total. Rather than take my word for the thresholds, move them yourself. Green survives your filter, white does not.

Aerial imagery of dense Parisian blocks with detected building polygons drawn over it

82 / 635polygons kept (13%)

84%of the built area (222,338 m²)

The same 635 detections the attribute table holds. Drop the confidence to zero and the courtyard sheds and skylights come back.

Watch the second number while you drag the first. Throwing away 87% of the polygons costs 16% of the area. The rest is noise you'd have deleted by hand anyway, one at a time, while wondering whether the tool was any good.

Tune both to the job. A survey of industrial sheds can push the area floor to 200 m². Mapping informal settlements, 50 m² throws away real houses, so drop to 15 and lean on the confidence score instead.

What a clean result looks like

Paris is a hard case. Same tool on detached housing about 10 km west:

Detached and semi-detached houses in a Paris suburb, each house filled with its own colour
Detached housing, review filter on. One polygon per house, almost nothing to throw away.

85

median polygon area

Paris run: 3.2 m²

0.79

median confidence

Paris run: 0.26

251polygons

kept, out of 251 returned

Paris run: 82 out of 635

Same tool, same city, nothing to throw away. What changed is the built fabric, not the model.

Where this breaks: dense continuous blocks

Close view of Haussmann blocks, each block one coloured polygon following the street edge with courtyards cut out
The outline follows the street edge precisely and cuts out the courtyards. What it does not do is split the block into individual addressed buildings.

Each polygon traces the built envelope of a whole block, hugging the street line and correctly cutting out the courtyards. Good for built-up area or impervious surface, wrong if you need a polygon per address. No model reading a vertical image can find the party wall between two attached buildings, because from above there is nothing there to see.

So I wouldn't use automatic detection for a per-address layer in a historic city centre. Cadastral data plus manual correction wins there.

Cleaning the geometry

Three native QGIS tools tidy a footprint layer, and the order matters because simplify moves the vertices you just squared.

  1. Simplify, 0.5 m tolerance over aerial imagery. Cuts the vertex count hard without moving the boundary anywhere you'd notice.
  2. Orthogonalize. Snaps near-right angles square. Reach for it on open data or hand-traced work, where nothing has squared them yet.
  3. Delete holes, only if you want solid footprints. Not on the Paris result: those holes are courtyards and they're correct.

On a detected layer step 2 is close to a no-op. I measured that rather than assume it, running Orthogonalize over 190 detected buildings and comparing all 1,845 corners before and after.

87.9%

corners already within 1° of square

before running anything

87.9%

after Orthogonalize

the same 1,845 corners

1.7cm

median vertex shift

9.1 cm at the worst

Close view of detected building outlines on aerial imagery, corners meeting at right angles
The same detections, close in. The corners arrive square, so the cleanup step has nothing left to snap.

The 12% that are not square are the attached terraces. Look at the stepped edge running down the middle of the block. No corner tool fixes that, because those steps follow a real roof line rather than a modelling error.

Which method to use

Open datasetsHand-digitizingAutomatic detection
CostFreeFreeFree tier, then paid
SetupMinutesNoneMinutes
Good forAreas already covered wellUnder ~50 buildingsHundreds to thousands
Matches your imageryNoYesYes
Consistent across a teamYesNoYes
Dense continuous blocksVariesYesBlock envelopes only
Provenance you can stateDataset and vintageYouYour imagery, with a confidence score

Questions I get

Does it work on drone imagery? Better than on satellite. Ground resolution matters more than the source: a 5 cm orthophoto gives cleaner boundaries and higher confidence than a 30 cm satellite scene.

Do I need a GPU? No. Both modes run on our servers by default, and the small local model runs on your own CPU, slower and less accurate. If you want everything to stay on your machine, Geo-SAM and samgeo are free and good, and they do want an NVIDIA card.

What does a run cost? One credit per tile in automatic mode, one credit per object saved in semi-automatic. Every account gets a free allowance each month, and the local model costs nothing at all.

Try it free in QGIS, no card needed