2

Using ArcGIS Desktop 10.5 I am looking to find the minimum elevation in x number of polygons using a DEM. Using Zonal Statistics method:

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "Path/Default.gdb"
outZSaT = ZonalStatisticsAsTable("Tests", "FID", "dem.img", "output_table","DATA","MIN")

enter image description here

In another approach, I convert the polygon to a raster, convert the raster to points, and then extract values to the points from the DEM. When I do this I see elevation values that are lower than the absolute minimum that Zonal Statistics as Table returns. (RASTER VALUE is the elevation). These are the pt values in my polygon with FID sorted by RASTERVALU in ascending order. Note the min values found by Zonal Statistics are somewhat far down this list. enter image description here

I would expect the MIN for FID 0 here to be 5.380977

What may account for this discrepancy and how can I fix it?

  • Check cell size in environment settings. Set it equal one of dem. – FelixIP Oct 2 '17 at 19:20
2

I don't have your dataset for testing, but here is the most probable reason for the discrepancy:

Zonal stat (and other tools such as tabulate area), is, in fact, a raster/raster comparison tool. When you enter a vector feature class, there is an internal conversion of the vector to "in memory" raster. And a default pixel size is selected by ArcGIS based on the extent size, which optimizes the process but may lead to interpolation errors like in your case.

If you want to avoid this, I recommend you to convert the vector polygons to a raster of the same pixel size and the same extent (use the snapping extent when converting) as the "value" raster. Alternatively, you can manage the size of the pixel during the analysis from the "environment" settings of your tools.

arcpy.env.cellSize = your_value_raster_name

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.