I want to convert OSM street blocks for a given area into polygons in QGIS (see image). I can of course manually draw lines with OSM as a base layer, and then convert these lines into polygons. However, this is a very tedious job. Is there a better way of getting this done ?
-
Can you use something like the Overpass API online to query OSM for the raw data? Or get a raw OSM file from somewhere like GeoFabrik and extract the buildings layer? I assume your image above is from OSM raster tiles?– SpacedmanNov 14, 2021 at 16:03
-
The image is a manaul drawing. I can get the exepcted result on screen by buffering the street lines and afterwards creating a symmetric difference with the area. But the result returns a single multipolygon image that cannot be split up into the individual polygons. At least, not as far as I know.– EricBHKNov 14, 2021 at 16:27
-
Ah, I thought the grey was building outlines. You only have road centerlines? So you need to buffer out the road width? Hmmm. But you can do Multipolygon-to-Polygon in QGIS, I'm sure...– SpacedmanNov 14, 2021 at 16:39
-
You might get the result by using OSM land use types. e.g. in my neighbourhood, landuse=residential and landuse=commercial would work pretty well (they don't overlap roads, so they model the idea of a "street block" quite well). wiki.openstreetmap.org/wiki/Key:landuse– alphabetasoupNov 14, 2021 at 20:39
-
@alphabetasoup : I tried your solution, but since I am working mostly with developing countries, landuse is hardly or not at all available in OSM for these areas– EricBHKNov 15, 2021 at 9:49
1 Answer
Okay, I figured it out. Here is the sequence of actions in order to obtain the proper result :
- first, buffer your lines
- next, create a symetric difference
- finally, use 'multiple to individual'
This will get you the individual street blocks, each as a single polygon