#--------------------------------------------------------------------------- # delimita.py # Created on: Thu Dec 05 2013 07:18:26 AM # # Description: # Es importante que e Modelo de Elevacion tenga Proyeccion UTM, caso contrario, cambie al Sistema de Proyeccion Sugerido # --------------------------------------------------------------------------- # Import system modules import sys, string, os, arcpy#arcgisscripting # Create the Geoprocessor object #not used in 10.1 #gp = arcgisscripting.create() # Check out any necessary licenses arcpy.CheckOutExtension("spatial") # Load required toolboxes... arcpy.AddToolbox(r"C:\Program Files\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Spatial Analyst Tools.tbx") # Set the Geoprocessing environment... #not used in working example #arcpy.extent = "DEFAULT" #The only input variable to this script: dem = r"C:\Users\Me\Desktop\M130_B90\M130_B90\M130_38076DSQ_BIG.dem" # downloaded from: # http://estuarinebathymetry.noaa.gov/bathy_htmls/M130.html # Local variables... lleno = r"C:\Users\Me\Desktop\M130_B90\lleno" direccion = r"C:\Users\Me\Desktop\M130_B90\direccion" Output_drop_raster = "" acumula = r"C:\Users\Me\Desktop\M130_B90\acumula" condicional = r"C:\Users\Me\Desktop\M130_B90\condicional" Input_true_raster_or_constant_value = "1" Expression = "Value > 4000" drenaje = r"C:\Users\Me\Desktop\M130_B90\drenaje.shp" # Process: Fill... if not os.path.exists(lleno): arcpy.Fill_sa(dem, lleno, "") # Process: Flow Direction... if not os.path.exists(direccion): arcpy.FlowDirection_sa(lleno, direccion, "NORMAL", Output_drop_raster) # Process: Flow Accumulation... if not os.path.exists(acumula): arcpy.FlowAccumulation_sa(direccion, acumula, "", "FLOAT") # Process: Con... if not os.path.exists(condicional): arcpy.Con_sa(acumula, Input_true_raster_or_constant_value, condicional, "", Expression) # Process: Stream to Feature... if not os.path.exists(drenaje): arcpy.StreamToFeature_sa(condicional, direccion, drenaje, "SIMPLIFY")
dem = gp.GetParameterAsText(0) output = gp.SetParemeter)(1)
import arcpy if arcpy.Exists(output1): arcpy.SolveNetwork(output1, output2)
import locale class ToolValidator: """Class for validating a tool's parameter values and controlling the behavior of the tool's dialog.""" def __init__(self): """Setup the Geoprocessor and the list of tool parameters.""" import arcgisscripting as ARC self.GP = ARC.create(9.3) self.params = self.GP.getparameterinfo() def initializeParameters(self): """Refine the properties of a tool's parameters. This method is called when the tool is opened.""" self.params[1].Schema.GeometryType = "Polyline" self.params[1].Schema.FieldsRule = "AllFIDsOnly" return def updateParameters(self): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parmater has been changed.""" if self.params[2].altered: if self.params[0].value and self.params[2].value: field = self.GP.CreateObject("Field") field.name = self.params[2].value.value self.params[1].Schema.AdditionalFields = [field] return def updateMessages(self): """Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.""" return
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.