Chapter 2. Python basics
This chapter covers
- Using the Python interpreter vs. writing scripts
- Using the core Python data types
- Controlling the order of code execution
You can do many things with desktop GIS software such as QGIS, but if you work with spatial data for long, you’ll inevitably want to do something that isn’t available through the software’s interface. If you know how to program, and are clever enough, you can write code that does exactly what you need. Another common scenario is the need to automate a repetitive processing task instead of using the point-and-click method over and over again. Not only is coding more fun and intellectually stimulating than pointing and clicking, but it’s also much more efficient when it comes to repetitive tasks. You have no shortage of languages you could learn and work with, but because Python is used with many GIS software packages, including QGIS and ArcGIS, it’s an excellent language for working with spatial data. It’s also powerful, but at the same time a relatively easy-to-learn language, so that makes it a good choice if you’re starting out with programming.