Calculating Extremes in Elevation Rasters Via Numpy Using a SHP/FC Polygon Grid As Input

09-01-2016 07:47 AM
Occasional Contributor

Attached python script can be used directly or as inspiration for calculating point elevations within a set of gridded polygons. It will likely require modification if the polygons are not in a gridded format. It is intended for loading within the ArcMap python window and was tested with WGS84.img raster (default install in ArcMap) and the georef15 shapefile (default install in ArcMap). User needs to create a feature class or shapefile prior to running the tool to hold the output spot elevations. The output fc shouhld have a field that matches a uniqueID/name of the input polygons (in the case of georef15 I used 'Code'), a field for output Elevation (default 'Elevation' type double), and a field for the extrema type (default 'Extrema' type string length 3). Options include the ability to do a negative buffer in percent (default 0.05, min is 0, max is 0.49999...) and to use a subgrid within the polygons (default is 2 so a 2x2 subgrid, change to 1 if you just want min/max within the original poly).

Call the function with the arguments, example:

createSpotElevations('WGS84.img','georef15','SpotElevations','Code',gInsideBufferFactor = 0, subgridSize = 1)

Good Luck.


Note also posted within a modelbuilder response.

Edit: Noticed I had the Min/Max Tags backwards. 

0 Kudos
0 Replies