Skip to main content
improved formatting
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from raster to polygon conversion so it needs some changes because of "unsigned integer" and ...that I don't know.

JowHow can I correct this code?

I'm getting an error while executing it.

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

import arcpy, os
from arcpy import env
from arcpy.sa import *

#To overwrite output
arcpy.env.overwriteOutput = True

#Set environment settings
env.workspace = "K:\1400-10-20"

outws="K:\1400-10-20\m"

#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(i, outPolygons, "NO_SIMPLIFY", field)

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from raster to polygon conversion so it needs some changes because of "unsigned integer" and ...that I don't know.

Jow can I correct this code?

I'm getting an error while executing it.

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

import arcpy, os
from arcpy import env
from arcpy.sa import *

#To overwrite output
arcpy.env.overwriteOutput = True

#Set environment settings
env.workspace = "K:\1400-10-20"

outws="K:\1400-10-20\m"

#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(i, outPolygons, "NO_SIMPLIFY", field)

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from raster to polygon conversion so it needs some changes because of "unsigned integer" and ...that I don't know.

How can I correct this code?

I'm getting an error while executing it.

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

import arcpy, os
from arcpy import env
from arcpy.sa import *

#To overwrite output
arcpy.env.overwriteOutput = True

#Set environment settings
env.workspace = "K:\1400-10-20"

outws="K:\1400-10-20\m"

#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(i, outPolygons, "NO_SIMPLIFY", field)

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from raster to polygon conversion so it needs some changes because of "unsigned integer" and ...that I don't know.

Jow can I correct this code?

I'm getting an error while executing it.

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

   `importimport arcpy, os
    ... from arcpy import env
    ... from arcpy.sa import *
    ... 
    ... #To overwrite output
    ... arcpy.env.overwriteOutput = True
    ... 
    ... #Set environment settings
    ... env.workspace = "K:\1400-10-20"
    ... 
    ... outws="K:\1400-10-20\m"
    ... 
    ... #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(i, outPolygons, "NO_SIMPLIFY", field)

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from raster to polygon conversion so it needs some changes because of "unsigned integer" and ...that I don't know.

Jow can I correct this code?

I'm getting an error while executing it.

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

   `import arcpy, os
    ... from arcpy import env
    ... from arcpy.sa import *
    ... 
    ... #To overwrite output
    ... arcpy.env.overwriteOutput = True
    ... 
    ... #Set environment settings
    ... env.workspace = "K:\1400-10-20"
    ... 
    ... outws="K:\1400-10-20\m"
    ... 
    ... #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(i, outPolygons, "NO_SIMPLIFY", field)

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from raster to polygon conversion so it needs some changes because of "unsigned integer" and ...that I don't know.

Jow can I correct this code?

I'm getting an error while executing it.

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

import arcpy, os
from arcpy import env
from arcpy.sa import *

#To overwrite output
arcpy.env.overwriteOutput = True

#Set environment settings
env.workspace = "K:\1400-10-20"

outws="K:\1400-10-20\m"

#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(i, outPolygons, "NO_SIMPLIFY", field)
deleted 90 characters in body; edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from this linkraster to polygon conversion so it needs some changes because of "unsigned integer" and ...that I don't know. how

Jow can I correct this code? I'm

I'm getting an error while executing it. Could you have some suggestions, please?

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

   `import arcpy, os
    ... from arcpy import env
    ... from arcpy.sa import *
    ... 
    ... #To overwrite output
    ... arcpy.env.overwriteOutput = True
    ... 
    ... #Set environment settings
    ... env.workspace = "K:\1400-10-20"
    ... 
    ... outws="K:\1400-10-20\m"
    ... 
    ... #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(i, outPolygons, "NO_SIMPLIFY", field)

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from this link so it needs some changes because of "unsigned integer" and ...that I don't know. how can I correct this code? I'm getting an error while executing it. Could you have some suggestions, please?

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

   `import arcpy, os
    ... from arcpy import env
    ... from arcpy.sa import *
    ... 
    ... #To overwrite output
    ... arcpy.env.overwriteOutput = True
    ... 
    ... #Set environment settings
    ... env.workspace = "K:\1400-10-20"
    ... 
    ... outws="K:\1400-10-20\m"
    ... 
    ... #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(i, outPolygons, "NO_SIMPLIFY", field)

I'm trying to automate the conversion of raster to polygon and the raster files are in "TIF" format which is a "floating point". I copy the code below from raster to polygon conversion so it needs some changes because of "unsigned integer" and ...that I don't know.

Jow can I correct this code?

I'm getting an error while executing it.

Runtime error Traceback (most recent call last): File "", line 18, in TypeError: 'NoneType' object is not iterable

Code

   `import arcpy, os
    ... from arcpy import env
    ... from arcpy.sa import *
    ... 
    ... #To overwrite output
    ... arcpy.env.overwriteOutput = True
    ... 
    ... #Set environment settings
    ... env.workspace = "K:\1400-10-20"
    ... 
    ... outws="K:\1400-10-20\m"
    ... 
    ... #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(i, outPolygons, "NO_SIMPLIFY", field)
Improved formatting
Link
TomazicM
  • 27k
  • 23
  • 31
  • 42
Loading
added 88 characters in body
Source Link
MrXsquared
  • 35.6k
  • 22
  • 71
  • 121
Loading
Source Link
coral
  • 69
  • 6
Loading