I have taken out DEM data over a specific area and converted the raster to polygons.
Now I want to code so I get the max value and the min value of "gridcode" of every set of polygons that are connected to each other. The polygons that are disconnected are in the same layer so I need so seperate the disconnected polygons before making a for loop which test the min and max value.
Do anyone have an efficient solution?
My Code:
import arcpy
import os
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
arcpy.env.workspace = 'C:\Users\daniel\Studier\Applikationsutveckling\Projekt\Gavle'
pulka_pol = r'C:\Users\daniel\Studier\Applikationsutveckling\Projekt\Gavle\Gavle_projekt.gdb\Pulka.shp'
demdata_gavle = r'C:\Users\daniel\Studier\Applikationsutveckling\Projekt\Gavle\Demdata2\Demdata.tif'
outExtractByMask = ExtractByMask(demdata_gavle, pulka_pol)
if arcpy.Exists("mask_extract.tif"):
arcpy.management.Delete("mask_extract.tif")
outExtractByMask.save("mask_extract.tif")
outPolygons = r'C:\Users\daniel\Studier\Applikationsutveckling\Projekt\Gavle\dem_poly.shp'
arcpy.RasterToPolygon_conversion(outExtractByMask, outPolygons, "NO_SIMPLIFY", "VALUE")
