import sys, string, os, arcgisscripting gp = arcgisscripting.create() try: gp.CheckOutExtension("spatial") gp.AddToolbox("C:/Arquivos de programas/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx") gp.workspace = "E:/GIS_Mestrado/Corumbatai/3_Cartas_um_metro" out_workspace = "E:/GIS_Mestrado/Corumbatai/4_Cartas_Con/" mascara = "E:/GIS_Mestrado/Corumbatai/Geodados/Grid_Cartas_sem_Grade.shp" rasters = gp.ListRasters() raster = rasters.next() while raster: gp.extent = gp.describe(raster).extent gp.snapraster = raster output = out_workspace + raster + ".tif" #reformat as a .tif or whatever - it's that easy! gp.Clip_management(raster, gp.extent, output, mascara, "", "CLIPPINGGEOMETRY") gp.extent = "" #clear the extent raster = rasters.next() except: print "Error in script" print gp.GetMessages()
# Extracts the cells of a raster that correspond with the areas # defined by a mask. # Author: Michel # Date: 10 de Janeiro de 2011 # ----------------------------- # Import system modules import sys, string, os, arcgisscripting # Create the Geoprocessor object gp = arcgisscripting.create() try: # Check out any necessary licenses gp.CheckOutExtension("spatial") # Load required toolboxes... gp.AddToolbox("C:/Arquivos de programas/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx") gp.workspace = "E:/GIS_Mestrado/Corumbatai/3_Cartas_um_metro" out_workspace = "E:/GIS_Mestrado/Corumbatai/4_Cartas_Con/" mascara = "E:/GIS_Mestrado/Corumbatai/Geodados/Grid_Cartas_sem_Grade.shp" # Get a list of the rasters in the workspace rasters = gp.ListRasters() # Loop through the list of rasters rasters.reset() raster = rasters.next() while raster: # Set the outputname for each output to be the same as the input output = out_workspace + raster # Process: Extract by Mask... gp.ExtractByMask_sa(raster, mascara, output) # Loop da função... raster = rasters.next() except: # If an error occurred while running a tool, then print the messages. print "Error in script" print gp.GetMessages()
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.