I have a raster dataset (tiff) and I want to get a shapefile (polygons) that preserves all cells.

Unfortunately, the Raster to Polygon tool automatically merges all adjacent cells with the same values. I want to prevent this.

The only way that I could think of, is to change all cell values to an auto-incrementing value in order to avoid matching values and therefore a cell merge.

How could I do this? Or is there a more elegant way altogether?

2 Answers 2


Might not be the most elegant, but you could use Raster to Point and then create square buffers with dimensions equal to your cell size.

Alternatively, Create Fishnet with the extent of your raster and cell size once again matching. From there, it's just a simple Intersect between the two. Works with Basic license since you are only intersecting two layers (the grid and the result from Raster to Point).

Per @Tom, you can use the points output to create Theissen (Voronoi) Polygons. You'll need to either change the extent or create extra rows of points so that the outermost boundaries are handled correctly. You'll need an advanced license to run this tool.

Finally, there's always numpy to iterate over the raster and create Polygon objects.

  • 1
    Nice work-arounds to something that should be a built-in option on the Raster to Poly tool! BTW, for square buffers: in this instance, you could just create Thiessen polygons--just make sure you set the extent of the tool, or the cells on the edge will extend too far.
    – Tom
    Commented Mar 29, 2016 at 16:38
  • I just tried the fishnet approach and the resulting polygon raster is about twice the size of the input even though I defined it as the template and used the same row and col counts.
    – Chris
    Commented Mar 29, 2016 at 17:01
  • Is there a way to loop through raster cells and assign individual values to each cell?
    – Chris
    Commented Mar 29, 2016 at 17:02
  • @Chris, I'd probably use RasterToNumpyArray and go from there. Might be a bit overkill for what you're trying to accomplish though.
    – Paul
    Commented Mar 29, 2016 at 17:31
  • @Paul it is massive overkill altogether, but first line
    – FelixIP
    Commented Mar 29, 2016 at 19:34

Your original thought is correct: the best way to create fishnet with mesh size equal to raster size is not to use fishnet, but raster tools, because raster to point conversion creates 2 fields. One stores raster value and pointId stores sequential unique numbers.

Technique described below will work for both floating point or integer single band rasters.

Set your environment extent and snap raster to original raster. Set environment cell size to one of original.

Original raster: enter image description here enter image description here enter image description here

Output labelled by original raster values, transferred from points using pointid as join field and field calculator: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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