AnsweredAssumed Answered

raster to polygon conversion

Question asked by sean.woznicki on Jul 28, 2014
Latest reply on Jul 28, 2014 by sean.woznicki

Hi Guys,

I 'm trying to automate the conversion raster to polygon and the rasters files are in "TIF" format. I have the code below. However, I 'm getting an error while executing it. Could you have some suggestion please? Thank you very much for your time and help!

 

Regards,

Subhasis

 

Code:

 

import arcpy, os

from arcpy import env

from arcpy.sa import *

 

#To overwrite output

arcpy.env.overwriteOutput = True

 

#Set environment settings

env.workspace = "C:/Subhasis/Test/Neshanic_Python/extract"

 

outws="C:/Subhasis/Test/Neshanic_Python/extract/clip/"

 

#checkout ArcGIS spatial analyst extension license

arcpy.CheckOutExtension("Spatial")

 

inraster = arcpy.ListRasters("*", "TIF")

 

for i in inraster:

    filename=os.path.splitext(i)[0]

    outPolygons= outws + str(filename) + '.shape'

    field = "VALUE"

    arcpy.RasterToPolygon_conversion(inraster, outPolygons, "NO_SIMPLIFY", field)

Outcomes