1 / 30

Python, ArcToolBox, & Geoprocessing

Python, ArcToolBox, & Geoprocessing. MapMyRun.com. Overview. ArcToolbox overview ArcGIS Python scripting The arcgisscripting module & Geoprocessor object Environment settings Accessing system/custom tools Workspaces Case sensitivity Geoprocessing / Python helpful resources. Example:.

otis
Download Presentation

Python, ArcToolBox, & Geoprocessing

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. Python, ArcToolBox, & Geoprocessing

  2. MapMyRun.com

  3. Overview • ArcToolbox overview • ArcGIS Python scripting • The arcgisscripting module & Geoprocessor object • Environment settings • Accessing system/custom tools • Workspaces • Case sensitivity • Geoprocessing / Python helpful resources

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

  5. Accessing Geoprocessing in ArcGIS • GUI • Command line • Models • Scripts

  6. Scripts and ArcToolbox • Scripts can be added as tools to ArcToolbox • Should be fully debugged before they are added as a tool • Use PythonWin, for example, to run the script interactively until it is working perfectly • Can add flow control to your models • Branching with “if … elif … else” and output parameters (e.g. boolean) can be used to control flow • Repetition with “for” or “while”(Geoprocessing at 9.4 will offer iterators)

  7. arcgisscripting module The arcgisscripting module provides the method for you to create a Geoprocessor object PYD files are in the format of a .DLL file.

  8. arcgisscripting.create() Creating an ArcGIS Geoprocessor object …

  9. Python eval()

  10. Geoprocessor Dynamic Methods & Properties • Environment/Tool are dynamic methods/properties of the Geoprocessor • Names and values are dynamic as we will see in next few slides

  11. Environment settings • Parameters for a geoprocessing session • Saved in MXD/MXT, model, or script

  12. 9.2 had enumerations None envs.next() Enumeration objects have next and reset methods envs.next() envs.reset() envs.next() envs.next() None 9.3+ has Python lists

  13. Geoprocessor & Environment settings

  14. Geoprocessor Dynamic Methods & Properties • Environment/Tool are dynamic methods/properties of the Geoprocessor • Names and values are dynamic as we will see in next few slides

  15. Accessing system tools in Python • gp.<ToolName>_<ToolboxAlias> Use Toolbox alias on your toolboxes and tools.

  16. Workspaces • As far as the geoprocessor is concerned, a workspace is a: • Folder as described above • A file-based geodatabase • A geodatabase in Microsoft Access format • An SDE database connection

  17. Accessing a Workspace • gp.Workspace specifies the default workspace containing your data • This is optional … it does not need to be set to do geoprocessing • You can process data in different folders in the same geoprocessing command.

  18. .Exists and .OverWriteOutput • gp.Exists(object) • Test whether or not an object exists (folder, geodatabase, file, toolbox, etc.) • gp.OverWriteOutput = True (1) or False (0) • Specifies whether or not output files will overwrite files of the same name.

  19. Overview • ArcToolbox overview • ArcGIS Python scripting • The arcgisscripting module & Geoprocessor object • Environment settings • Accessing system/custom tools • Workspaces • Case sensitivity • Geoprocessing / Python helpful resources

  20. Be sensitive to case sensitivity • Geoprocessor properties / methods ARE NOT case sensitive • Path names ARE NOT case sensitive • Any variables that you use ARE case sensitive Either of these works fine …

  21. Geoprocessing help – ArcGIS Tutorial Focus is mostly on solving geoprocessing problems with models. However, does show how to use scripts in models.

  22. Geoprocessing help – Overlay & Extract poster Nice one-pager that graphically showsoverlay and extract functions.

  23. Geoprocessing help – “Quick Guide”

  24. Geoprocessing help – 9.2 Geoprocessor OMD

  25. Geoprocessing help – 9.3 Geoprocessor OMD Geoprocessing help – 9.3 Geoprocessor OMD

  26. Geoprocessing help – Automating with scripts

  27. Geoprocessing help – Tool reference

  28. Geoprocessing support page

  29. Overview • ArcToolbox overview • ArcGIS Python scripting • The arcgisscripting module & Geoprocessor object • Environment settings • Accessing system/custom tools • Workspaces • Case sensitivity • Geoprocessing / Python helpful resources

  30. For $1 Million …

More Related