#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: David Craig # # Created: 27/01/2017 # Copyright: (c) dcraig 2017 # Licence: <your licence> #------------------------------------------------------------------------------- import arcpy from arcpy import env """Python Toolbox Implementation""" class Toolbox(object): def __init__(self): self.label = "isoRoadsToolbox" self.alias = "" #Tool List self.tools = [NearAnalysis] class NearAnalysis(object): def __init__(self): self.label = "Near Analysis" self.description = "Takes the isolated roads files and determines identifies " +\ "how far each arc is from its the closest road as well as " +\ "a frequency count of dangles on each road arc - 2 means " +\ "a single isolated arc, 1 means the arc is on the end of " +\ "a multi-arc isolated road, 0 means the arc is not an endpoint" self.canRunInBackground = False def getParameterInfo(self): inWorkspace = arcpy.Parameter( displayName = "Workspace Database", name = "inWorkspace", datatype = "DEWorkspace", parameterType = "Required", direction = "Input" ) ngdAL = arcpy.Parameter( displayName = "NGD_AL File", name = "ngdAL", datatype = "DEFeatureClass", parameterType = "Required", direction = "Input" ) isoRoad = arcpy.Parameter( displayName = "Isolated Road File", name = "isoRoad", datatype = "DEFeatureClass", parameterType = "Required", direction = "Input" ) networkRoads = arcpy.Parameter( displayName = "Networked Roads File", name = "networkRoads", datatype = "DEFeatureClass", parameterType = "Required", direction = "Input" ) parameters = [inWorkspace, ngdAL, isoRoad, networkRoads] return parameters def isLicensed(self): return True def updateParameters(self, parameters): return def updateMessages(self, parameters): return def execute(self, parameters,messages): messages.addMessage("Running Script...") danglePts = parameters[2].valueAsText + "Points" arcpy.FeatureVerticesToPoints_management(parameters[2].valueAsText, danglePts, "DANGLE") messages.addMessage("Dangles found!") return
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question