Komodo template for ArcGIS

From Wildsong
Jump to navigationJump to search

I don't like to use the ESRI script interface, their Python toolboxes work better. This is because the entire Python project can be written in Python, there is no separate ESRI document to maintain in a toolbox file in ArcCatalog. Because of this, you can pick up the Python code implementing the toolbox and ship it to a friend much more easily.

Here is how I organize a project in Komodo IDE for ArcGIS.

sample_toolbox.pyt -- This file interfaces my python project to ArcGIS as a "Python Toolbox". The "Toolbox" class defined here lists the tools that the toolbox will contain; one toolbox can contain many tools. Note: Because of the .pyt extension, I had to mark the language property on this file in Komodo as "Python", otherwise it thinks it's a text file.

The .pyt file could contain the source for the tools but that's a poor programming practice, it's better to define each tool in a separate file.

sample_tool.py -- This file defines the parameters for my sample tool in a class called Sample_Tool.

main.py -- This file allows me to run the tool from the command line (or in the Komodo debugger.)

Using Komodo as your editor / debugger in ArcGIS

In ArcCatalog Geoprocessing -> Geoprocessing Options

Set script tool debugger / editor to point at komodo.

Links

http://resources.arcgis.com/en/help/main/10.2/index.html#/Creating_a_new_Python_toolbox/001500000034000000/