[GIS] How to extract vectors from map using QGIS

feature extractionpolygon-creationpolygonizeqgisraster

I am trying to extract building footprints from a raster map (as shown in the example below). Please note that the maps are out of copyright, have been scanned and georectified by a library and have been provided to me for exactly this purpose.

Scaled example - original geotif available on request

So far I have been using the NYPL Map-Vectorizer which works by first adjusting the brightness/contrast of the image, then setting a colour threshold to extract a black and white image, which in turn is processed using gdal_polygonize.py (followed by some simplification and removal of roads).

The issue is that this gives polygons of the inside of the building. Terrace buildings end up with a gap between them.

How can I post-process to remove the gap between the terrace buildings? Is there an altogether better method for extracting building footprints from this map?

Note: Solutions need to be able to run as a script. I'm able to test proposed techniques in QGIS.

Best Answer

For rough build up areas:

  1. Using python load image and scipy/numpy to:
    • smooth it to get "uniform darker colour" for buildings
    • reclassify image colours to change building from light gray to black

For the example image the result processed by python script looks like this: processed

  1. vectorize this adjusted image

Some graphics and CAD software has good tools to convert technical drawings lines to polylines and can be scriptable but it is far from perfect and needs much additional manual work:

polylines

At the end for these kind of tasks if you need good quality vector polygons you need to do that manually.

Related Question