1

I have a building footprint shapefile (polygons) that I want to convert to a raster. I use the Polygon to Raster tool, and specify a cell size by importing from another raster (which is 24m x 30m). The results appear to show that only a couple of the polygons have been rasterized. Why is it that some polygons are and some aren't?

I've attached a picture below showing my results. Pink = building footprint; red = raster pixels after using tool Polygon to Raster. I would like to have a raster file that covers ALL of the building footprints (pink).

enter image description here

  • I guess the answer lays in the -at option: gdal.org/gdal_rasterize.html > **-at:**<br> Enables the ALL_TOUCHED rasterization option so that all pixels > touched by lines or polygons will be updated, not just those on the > line render path, or whose center point is within the polygon. > Defaults to disabled for normal rendering rules. But now I've the same problem. I don't know how or where to run this gdal statement in qgis: gdal_rasterize -at -l layer_name -a identifi_2 -ts 0.0 0.0 -a_nodata 0.0 -te 100455.11 501013.911 113954.594 530376.02 -ot Float32 -of GTiff p – ThomasHaarlem Oct 17 '18 at 13:39
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review – Mark Ireland Oct 17 '18 at 14:24
2

If you want every cell that contains a building to be switched on then don't use the polygons...

Create centroids using Feature to Point for the polygons and use Point to Raster to generate the raster. This will guarantee that each cell that has a building centre on it will have a value.

Optionally, if you want cells that contain part of a building but not necessarily the centre then use Feature Vertices to Points to generate the points which will give one point for each vertex of the polygons.

1

Looks like the cell assignment method is CELL_CENTER (so polygon would need to be located over the cell center to be digitized). Using MAXIMUM_AREA will capture more of the polygons, although possibly not all since the cell size is so much larger relative to the polygons.

You might get closer to the results you want if you first make a Minimum Bounding Geometry polygon, then convert that to a raster. It would help fill in the gaps between the buildings.

  • I tried both the suggestions. With the MAX_AREA I ended up getting the same results, and with the minimum bounding geometry I ended up with less raster pixels. – poly_to_ras Jul 25 '14 at 0:34

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.