Great sample. Thought to add for reference if one wanted to calculate the output as Raster in Map Algebra
from arcpy.sa import * import math asp = Aspect(inElevation) aspNull = SetNull(asp, asp, "VALUE = -1") aspCos = Cos(aspNull * math.pi / 180.0) aspSin = Sin(aspNull * math.pi / 180.0) xxSumSin = ZonalStatistics(inZones,"OBJECTID", "aspSin", "MEAN", "DATA") xxSumCos = ZonalStatistics(inZones,"OBJECTID", aspCos, "MEAN", "DATA") asp_azm = (360+(ATan2(xxSumSin,xxSumCos)) * (180 / math.pi)) % 360.0
I have roughly ~700 polygons that I would like to derive the mean aspect for each. I've downloaded the zip file and input the polygon featureclass. I've also specified the zoneID field but the tool won't accept any of my elevation rasters. I've tried exporting my rasters to ESRI grid, I've tried changing the source type properties from generic to elevation. I've tried shortening the file names and the tool always returns ERROR -1 Input must be an ESRI grid...I'm not sure where I've gone wrong. Any help/advice would be greatly appreciated
I've revised the code to be compatible with ArcGIS Pro, and to accept either a TIFF or ESRI grid as the elevation raster.
The revised toolbox and user guidance are attached as a ZIP file.
This rules. Thank you.
The toolbox and revised user guidance are attached here as a ZIP file.
The toolbox only runs in ArcGIS Pro.
Any thoughts on why the output for Aspect_Azm column is entirely null and the Aspect_Cls column is entirely 000 NO? I got the tool to run successfully. No errors popped up. I was super excited to find this and I'm hoping I can get it to work!
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.