1 / 21

Day 02: T ools, messaging, results, error handling

Day 02: T ools, messaging, results, error handling. GIS Workstation. Something cool …World Construction Set. http://www.3dnature.com. More cool stuff …. Frankos Maps – Beautiful maps of hiking trails, etc. created using ArcGIS and "other" software

kaden
Download Presentation

Day 02: T ools, messaging, results, error handling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Day 02: Tools, messaging, results, error handling GIS Workstation

  2. Something cool …World Construction Set • http://www.3dnature.com

  3. More cool stuff … Frankos Maps – Beautiful maps of hiking trails, etc. created using ArcGIS and "other" software David Rumsey's Historical MapsDetailed scans of historical maps on the internet!

  4. Tools, results, messages, errors • Using ArcGIS Toolbox of Geoprocessing tools • Processing results • Creating your own toolbox with your own tools and messaging • Error trapping

  5. ArcToolbox & Geoprocessing Example: * ArcToolbox Toolbox * * Tool Toolset Tools may have same nameif they are in different toolboxesExample: Clip_analysis Clip_management System tool Model Toolboxes, Toolsets, Tools depend on license Script

  6. Accessing Geoprocessing in ArcGIS GUI Python Window Models Scripts Run in PythonWindow,PyScripter/IDE,or command line

  7. Finding tools

  8. ToolName ToolboxAlias Using ArcGIS tools with Python To use any tool … import arcpy arcpy.<ToolName>_<ToolboxAlias>(args)

  9. Using ArcGIS tools with Python OR, open the tool and get Tool Help

  10. Using ArcGIS tools with Python … and scroll downto Syntax andCode samples

  11. Result inputCount: Integer maxSeverity: Integer messageCount: Integer outputCount : Integer resultID: String status : Integer cancel() : Void getInput(index : Integer) : Recordset or String getMapImageURL({parameter_list}, {height}, {width}, {resolution}) : String getMessage(index : Integer): String getMessages({severity : Integer}) : String getOutput(index : Integer) : Object getSeverity(index : Integer) : Integer Tool Result object

  12. Creating custom script tools To create a script tool, you need three things: • A script • A custom toolbox • A precise definition of the parameters of your script

  13. Create a script From scratch … • Write and debug in PyScripter • Use sys.argv for script parameters/arguments to start • Once script is working, add it to a toolbox … Using ModelBuilder • Create a model • Export to Python • Edit in PyScripter (might not work in ModelBuilder after edit) • Once script is working, add it to a toolbox …

  14. Create custom Toolbox Custom location Create a custom toolbox(.tbx file) Default location username

  15. Define Toolbox Alias and Description

  16. Add script to Toolbox

  17. Defining script tool input parameters Like sys.argv without 1024 byte limit and only used in script tools

  18. Defining script tool output parameters # Set output parameter # arcpy.SetParameterAsText(1, outFCName) Refer to Setting output parameters … in help.arcgis.com

  19. Tool Messages Refer to Writing messages in script tools in help.arcgis.com

  20. Error trapping • GetMessages(2)  Messages with severity of 2 = Error Messages

More Related