Al ejecutar el siguiente script, me da el error de que necesito un valor para "origin_coord" y para "y_axis_coord". Entonces, ¿no es suficiente con definir un conjunto de datos de plantilla? Pero, ¿cómo puedo llenar el "origin_coord" y "y_axis_coord" parámetros con Arcpy trabajando con ArcMap 10.0? Porque en el bucle son un montón de shapefiles de diferentes ciudades, así que necesito un bucle.
import arcpy
import os
from arcpy import env
env.overwriteOutput = True
env.workspace = r"D:\Users\julia\out_09_09\urbanA"
env.qualifiedFieldNames = False
#make a list with input cities as shapefiles.
fcList = arcpy.ListFeatureClasses()
for shpFile in fcList:
shpFileName= os.path.splitext (shpFile) [0]
print shpFileName # works
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(env.workspace + "\\" + shpFile, "shpFile_ly")
# join the city with the reclasstable
jointable = r"D:\Users\julia\out_09_09\reclass.dbf"
arcpy.AddJoin_management("shpFile_ly", "CODE", jointable, "joinCODE", "KEEP_ALL")
# Process: Copy Features
outFeatureClass = shpFileName + "_join.shp"
arcpy.CopyFeatures_management("shpFile_ly", outFeatureClass)
# Process: Polygon to Raster
outraster = shpFileName + "_join.img"
cellSize = 200
arcpy.PolygonToRaster_conversion(outFeatureClass, "CODE", outraster, "CELL_CENTER", "NONE", cellSize)
# Process: Make Raster Layer
arcpy.MakeRasterLayer_management(outraster, "outraster_ly")#works
# Process: Add Join
arcpy.AddJoin_management("outraster_ly", "Value", jointable, "code", "KEEP_ALL")
# Process: Copy Raster
outraster2 = shpFileName + "_join2.img"
arcpy.CopyRaster_management("outraster_ly",outraster2) #works
# Process: Raster to Polygon
outPolygons = shpFileName + "reclass.shp"
arcpy.RasterToPolygon_conversion(outraster2, outPolygons, "NO_SIMPLIFY", "Value")#works
# Process: Create Fishnet
cellSizeWidth = "200"
cellSizeHeight = "200"
outFishnet = shpFileName + "_net.shp"
arcpy.CreateFishnet_management(outFishnet, "", "", cellSizeWidth, cellSizeHeight, "0", "0", "", "NO_LABELS", outPolygons, "POLYGON")
¿Hay alguien que pueda ayudarme? Lo estoy intentando sin la Iteración pero no funciona aunque añada una capa antes? ¿Por qué?
import arcpy
from arcpy import env
env.overwriteOutput = True
env.workspace = r"D:\Users\julia\erste_aufg"
# Process: Make Feature Layer
#arcpy.MakeFeatureLayer_management(r"D:\Users\julia\erste_aufg\de013l_hannover \de013l_hannover\de013l_hannover.shp", "hannover_ly")
#Process: Create Fishnet
outFeatureClass = r"D:\Users\ju\ers\result\hannover_fisch.shp"
cellSizeWidth = '200'
cellSizeHeight = '200'
templateExtent = r"D:\Users\ju\ers\de013l_hannover\de013l_hannover\de013l_hannover.shp"
arcpy.CreateFishnet_management(outFeatureClass, "", "", cellSizeWidth, cellSizeHeight, '0', '0', "", "NO_LABELS", templateExtent, "POLYGON")