3

I want to convert a raster file (100x100m pixel size) which contains population counts as pixel values. I need a vector based file of the 100x100m grids and the population as attributes.

I tried different conversion methods in QGIS, but there will always be pixels merged together. Is there a way to create a vector grid and assign the raster values to them?

  • Adjacent pixels with the same values are merged together when converted to polygons? You could create a fishnet and intersect with output to recreate the grid – BERA Aug 31 '18 at 10:37
  • Thank you. Do you know how to create the fishnet to match it with the same position as the raster cells? – boondigga Aug 31 '18 at 10:41
2

Yet another option would be SAGA Raster values to points tool (QGIS Processing Toolbox | SAGA | Vector <-> raster). Choose [1] cells as Type option.

SAGA - Raster values to points

enter image description here note white moth-eaten appearance, which is nodata holes.


It was not clear what particular tools you have already tried, but one of them might have been GRASS r.to.vect tool (Type: area), which yields something like you have described:

GRASS - r.to.vect

enter image description here note internal nodata cells are treated as independent parts by GRASS

1

Alternatively you can do it directly with OpenJUMP Plus. Open your raster as a Sextante raster layer and use this tool

enter image description here

As a result you'll get a polygon layer that contains the pixel values as attributes. The other option "Create Lattice" creates points instead of polygons. In the image below blue rectangles are the generated polygons and attribute info is shown from the two selected and highlighted polygons.

enter image description here

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.