7

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.

6
  • Can you share some sample data with footprints and gaps? It would be so much faster to start making trials with your real data.
    – user30184
    May 25, 2014 at 15:09
  • Sure. I've uploaded to GDrive: drive.google.com/… Here you will find the original geotif (cropped.tif), the current NYPL script output (the zip shapefile), the intermediate tiff image, and a png example that shows that I can tweak the image manipulation to get a better input to the vectorizer process. (Note: Tiff files are 40mb and should be uploaded by the time you've read this)
    – RobJN
    May 25, 2014 at 15:18
  • I made a very quick trial with OpenJUMP topology tools and I have a feeling that this is not going to be trivial task at all. I could remove majority of gaps but the buildings tend to have odd shapes instead of rectangles. By using a small buffer (0.5 m) before cleaning the topology made result a bit better but not good still. Somehow I feel that for a good looking result the building outlines from the original scans should be extracted as well and the polygons should be snapped to this outline layer when the gaps are removed.
    – user30184
    May 25, 2014 at 16:26
  • The image shown is fairly pasty and dull. You will probably get better results if you adjust the contrast so it looks more monochromatic. This is a visual thing so it is best done interactively case by case (i.e. not one setting for all) in a package like photoshop; if you are editing outside of spatially aware programs remember to keep a world file as the save may overwrite the GeoTags. May 25, 2014 at 22:11
  • Yep, the image here is the original, but it's easy to get a monochromatic image from it (in fact that's what the NYPL Map-Vectorizer starts by doing). See the link to GDrive above for some test files. So any ideas how to eliminate the gap between terraced buildings?
    – RobJN
    May 25, 2014 at 22:57

2 Answers 2

1

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.

0

As per user30184 I gave FME a try with a buffer (again 0.5m gave the best result) and the propriatary 'SliverRemover' to clean the result. Looks okay but suitability depends on the ultimate purpose of the output. enter image description here

4
  • 1
    Welcome to GIS SE! It looks like you are offering a FME Answer to a Question with a QGIS requirement. Sometimes you will see people downvote in cases like this but since you are new I am hoping everyone will overlook that while you settle into the protocols of this site.
    – PolyGeo
    Jun 2, 2014 at 10:24
  • It's a suggestion for an alternative tool, nothing more, which the OP can ignore as desired.
    – DanF
    Jun 4, 2014 at 7:51
  • I'm happy to receive answers that propose alternate solutions, but in this case I don't know what FME is? I don't suppose you still have to output data so I can view this with the map in the background? Thanks
    – RobJN
    Jun 29, 2014 at 16:34
  • FME should be this software: safe.com/fme/fme-desktop
    – AndreJ
    Sep 8, 2014 at 5:23

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.