4

How can I convert a raster file to a vector file without making same value cells into one polygon?

enter image description here In the attached image, the values "2124", "2269", "2321", "2634", and "2920" are the polygons automatically combined. Is there any way to convert each pixel to one polygon?

user26767
  • 257
  • 1
  • 5
  • Welcome to GIS.SE. This appears to be two different questions, and the Q&A format of this site works best with only one question per Question. I'd recommend that you concentrate on one of them and research the other one separately, alternatively post as a separate question. – Martin Feb 10 '14 at 09:42
  • 1
    Are you sure that you need this ? Cell based analysis will be more efficient in the raster format. – radouxju Feb 10 '14 at 11:11
  • 1
    Hi radouxju, thanks for your comment. I'd like to display cells' values. I couldn't find any option for raster files to display them but for polygons as labels, that's why I need to convert. – user26767 Feb 11 '14 at 13:35
  • @user26767 You should specify what tool you used to create the undesired above result. I assume you used the GDAL polygonize. – Alexander Audet Jun 09 '22 at 00:49

2 Answers2

5
  1. Create a fishnet with the Vector grid tool in the Vector->Research Tools menu.
  2. Assign raster values to the polygons with the "Add grid values to shapes" tool in the Processing Toolbox (Simplified interface, GeoAlgorithms, Raster-vector, Raster->vector operations).
user2856
  • 65,736
  • 6
  • 115
  • 196
  • Thank you very much for your answer, Luke. I was able to get the result which I exactly wanted. And now I know the there is such toolbox. – user26767 Feb 12 '14 at 02:24
1

Another very good solution out there is to use the native QGIS Toolbox--> Vector Creation--> Raster pixels to polygons. As of QGIS 3.24, this algorithm still splits each cell into a separate polygon, unlike the GDal polygonize (Raster to Vector) function which I assume you used.

Depending on what you were trying to do, either function could be useful since I ironically was directed to this post when trying to research how to get like cells to cluster together. Also see this post for visuals.