5

I just started working with qgis and I have two maps of a town. On the one map buildings are outlined by Points, like this.

Building edges by points

And the other map is just black with White Buildings. like this.

black and white

My task is now to create a layer in which the buildings are polygons. I looked up some questions here and found some interesting stuff, but it never really worked for me. I tried some tools in qgis, like lines to Polygons, but it never worked.

Can you think of a way to auto-create a layer like this or should I just do it by hand?

Of course I'm asking this because it's a very big amount of data and I would rather not do it by hand.

===================

This is what the identifier gives me. "Kanal" is german for "channel" or "band" I think.

enter image description here

5

Assuming the buildings in your raster has a cell value of 190 (as you have shown in your image), you could try doing the following:


  1. Use the Raster Calculator to create a new raster only containing cells which have 190 (i.e. the output should only contain the buildings):

    Raster > Raster Calculator...
    

    And use the following expression:

    "raster@1" / ("raster@1" = 190)
    

  1. Polygonize the output raster from Step 1:

    Raster > Conversion > Polygonize (Raster to vector)
    

    Polygonize



Example:

  1. Original raster:

    raster

  2. Output of raster calculator:

    output

  3. Polygonized:

    Result

  • Oh yeah, that's a good idea! Sadly it's not the same black everywhere. Does somebody maybe know a way to just polygonize a selection of points, or maybe draw lines in a selection of points in order to use the Lines To Polygons tool? I used the plugin Points2One, but that takes all the points in the into account and makes one line out of it. – FinnGolovkin Apr 28 '17 at 13:53
  • @FinnGolovkin - What cell values are used for the buildings in your raster? Because we could use the Raster Calculator to change the cell values of your raster. – Joseph Apr 28 '17 at 14:00
  • I'm sorry but I'm not really sure what you mean by cell value. Do I already have cells? Can I inspect them somehow? Still pretty green :/ – FinnGolovkin Apr 28 '17 at 14:06
  • @FinnGolovkin - No problem! Your raster is made up of pixels (or cells) since it's basically an image file. If you use the Identify Features tool from the toolbar (View > Identify Features) and click somewhere on a raster, you should see some information like the band number (e.g. Band 1) and its value. If you click on some of your buildings, you can see what cell value they have and vice versa with any cells in your raster :) – Joseph Apr 28 '17 at 14:14
  • 1
    Oh man! It worked! Wow , this is exactly what I needed!! Thank you so much Joseph! – FinnGolovkin Apr 28 '17 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.