Following our discussion above here is a workflow that should get you what you need. However, please bear in mind that I anticipate some bumps in the road because I can predict from the image above that one or two steps wont go smoothly - but I'll suggest steps to overcome that.
- We are only interested in the blue lines so get rid of everything else. Reclassify your raster using
Reclassify by table from the
Processing toolbox. Set all values of 3 (blue) to equal 1 and everything else to NoData.
- Here is your first 'gotcha'. Those little black lines will cause breaks in the blue which will cause us problems later on. You have a whole slew of options involving raster resolutions and statistical filter passes but I am going to suggest a very simple fix that, while not the quickest method, is robust and easy to understand.... so we'll move on for now...
- Convert your new raster to polygons. Given the width of the blue lines compared to the black, this will result in slim polygons that represent a fat, broken outline of each building (not exactly what we want but getting there).
- Buffer and then de-buffer (negative buffer distance) the polygons by the same amount, where that amount generously spans the gaps in the blue 'walls' created by those pesky black lines. Ensure you dissolve the results of the first buffer operation. The buffer-with-dissolve 'heals' the breaks in the walls and bridges the tiny gaps. De-buffering again, reduces the buildings back to the size they ought to be. This process also has the advantage of removing some of the jagginess that vectorizing a raster can result in - which is why it may ultimately prove as fast or faster than some of my raster-based solutions to the black lines mentioned above.
- You now have doughnuts of the correct external size representing your buildings. So, loose the holes by using
Delete Holes from the
That gives you a polygon vector file from which you can either derive centroids or use the whole geometry as required. Bear in mind, if the latter is what you want, the buffering operation adds extra vertices, especially at the corners. You can use
Simplify to shed the extra verts and that may be beneficial (depending on your use-case).
You mention max building height and ground elevation - from the image presented, there is no obvious way of automatically deriving this. But if you can get another data source for the ground elevation (DTM). For the building heights - I suspect that there are probably blanket rules by zones, rather than individual properties. If so, I would overlay my new building polygons, add a new field for maxHeight and manually select groups of buildings - setting the height field for all in your selection in one go (saving some time over doing it building by building).