While writing Python code to run GIS processes may sound daunting at first, it is really not all that hard to get started and there are several significant benefits of using Python scripts to automate complex or repetitive processes that make learning Python worth the effort. Some of the principle benefits of writing Python code for automating GIS processes include:
- Results are easy to re-produce when processes are scripted
- Process for obtaining results is documented in the code
- Platforms like GitHub can be used to facilitate collaboration
- Scripted processes can run much more efficiently than manual processes
- Python skills developed working on GIS projects can also be utilized later in non-GIS projects
Selecting an IDE
An integrated development environment (IDE) application provides augmented text processing capabilities that make it easy to write, check, and run code. If you do not already have a preferred IDE, Jupyter
are two good options to consider. Both applications are free, open source, widely used, have a large ecosystem of community developed packages for extending their built-in functionality. If you select Atom as your IDE of choice for writing Python code, it is recommended that you also install a package like atom-python-run
which makes it easy to save and run your code from inside of Atom using defined shortcut buttons on your keyboard. One great advantage of using Atom with the atom-python-run package installed is that it makes it easy for you to set up Atom to run specific Python installations using the F5 and F6 hot keys on your keyboard which is especially important if you have multiple versions of Python on your computer (i.e. if you have both QGIS and ArcGIS Pro installed).
Selecting GIS Software & Getting Started Writing Python Code
Once you have installed an IDE, you should determine which GIS application's Python library you would like to use in your scripts. There are two major options to choose from (1) QGIS and its corresponding PyQGIS API and (2) ArcGIS Pro and its corresponding ArcPy
Python package. For information on getting started with with these two different approaches to scripting your GIS workflows click on the relevant button below.