Select to view content in your preferred language

Converting DEM raster to polygons, keeping amount of pixels

795
2
09-01-2023 03:56 AM
Labels (1)
TobiasWalter
New Contributor

I have a DEM raster for Germany with about 2000 pixels. A "value" that describes the altitude below or above the sea level is attached to each individual pixel in the attribute table that I gained access to when I converted the raster from float to integer using the Int-tool.

I would like to convert the raster to polygons, but by converting every raster pixel to a polygon so that the number of polygons matches the amount of raster pixels.

Background: I would like to use joins later, to add the "values" from the raster to each polygon that has been created.

What is the right way to do that probably? Whenever I use "Raster to polygon" and/or "Reclassify", I obtain way more polygons then raster pixels, mostly about 55000. When I use the created polygon-file, I cannot copy the "values" from one attribute table to another.

 

Thank you in advance,

Tobias

 

0 Kudos
2 Replies
Luke_Pinner
MVP Regular Contributor

@TobiasWalter wrote:

I have a DEM raster for Germany with about 2000 pixels. A "value" that describes the altitude below or above the sea level is attached to each individual pixel in the attribute table that I gained access to when I converted the raster from float to integer using the Int-tool.


You probably have more than 2000 pixels. Have a look at the attribute table, you'll see value and count columns.  The count column has the number of pixels in the raster that have the corresponding value. Unless every one of the 2000 records has a count of 1, then you have more than 2000 pixels (sum up the counts to get the total, excluding any nodata pixels).

If your attribute field is integer or string, just specify it as the field to copy to the output in the Raster to Polygon tool.

If your attribute field is neither integer or string, after you convert the raster to polygon, use the Join Field tool to copy the field across, you don't have to have the same number of rows.  Alternatively,  you can run Dissolve (or Pairwise Dissolve) on the output, then join.

 

0 Kudos