The Use of Python in GIS

Mark Altaweel


The use of Python with GIS has substantially increased over the last two decades, particularly with the introduction of Python 2.0 series in 2000, which included many new programming features that made the language much easier to deploy. Since that time, Python has not only been utilized within commercial GIS such as products by Esri but also open source platforms, including as part of QGIS and GRASS. In fact, Python today is by far the most widely used language by GIS users and programmers. Large companies such as Esri have embraced Python because it is a relatively easy language that many users have fully accepted.[1]

Benefits of Using Python in GIS

The main benefit to Python is the reduction of redundant behavior. For instance, doing multiple viewshed analyses would take some time if one were to only use the native platform of GRASS or QGIS. However, by integrating simple loops that process starting points and simple rules affecting the viewshed, many areas can be applied in a single process. Additionally, this now also opened up the possibility for many GIS users to create specific programs within their larger applications to enable batch runs, enable dynamic compiling, access a wide array of open source tools, easy memory allocation, and other utilities.[2] Most GIS users utilize Python like a script rather than apply its object oriented or imperative programming style features. In other words, Python is often applied to solve specific but limited problems as part of a wider application or analysis. The language is constantly evolving, however, usually based on the user community’s input, which has been part of the language’s early philosophy.[3]

Recognizing that many users simply want an easy script to use within a program, this has led to its simplified development. In fact, the main advantage of Python relative to other languages, such as C, C++, and other higher-level languages, is that Python is relatively easy to learn, with the syntax looking more like human language and functions, that users often struggle with such as garbage collecting, automated. Nevertheless, Python, with its numerous libraries, is relatively powerful, despite its easy syntax, and today it has enabled new types of applications to be made, such as GIS for mobile devices, integration of mapping features with web programs, and other areas that require server and cloud based services for many new tools.[4] Python allows access to well know libraries such as Google Maps and other popular Google software, as one example. In effect, Python has allowed a wide range of programmers to more easily integrate a variety of software and make GIS and mapping tools integrated with other popular tools and devices. This helps to largely explain the large growth in mobile devices and other applications using GIS tools and mapping seen today.

Free weekly newsletter

Fill out your e-mail address to receive our newsletter!

Future of Python in GIS

The future of GIS with Python does remain challenging. For instance, while Python 3.x has been in development, many programs have been written in Python 2.x series, providing some challenges in getting older code to work with newer versions of Python that have been in development. There are weaknesses to the language. As an example, Python was initially designed to be more of a scripting language, where many programmers still apply it as such. The language is an interpreted language, thus making it slow compared to C/C++ since compiling does not happen before runtime. However, it can be deployed as an object oriented program, which is more typical for larger software applications. The language does not easily inform on errors within the code until it is executed, making it sometimes harder to fix programming errors than what might be the case in other language. Information hiding, common to many languages, is not explicit, leading to more onerous and extra coding on experienced programmers to build tools with Python that match the sophistication of some other languages. The fact that Python tries to make it easier for many to use the language has sometimes made it more difficult for others to utilize common programming techniques seen in other languages.[5]

Nevertheless, the philosophy behind Python is simplicity is always best. This might not be a useful philosophy for everyone but it has meant that Python has a much larger user community, leading to many major software companies to embrace Python even when other parts of their software are built in other languages.


[1] For more on the versions of Python and the user community, including its history, see:  Telles, M.A. (2006) Python power!: the comprehensive guide. Boston, MA, Thomson Course Technology PTR.

[2] For more on the benefits of Python, see:  Payne, J. (2010) Beginning Python: Using Python 2.6 and Python 3.1. Indianapolis, IN, John Wiley & Sons Inc.

[3] For more on the Python user community, see:  Payment, S. (2015) Getting to know Python. Code power : a teen programmer’s guide. First edition. New York, Rosen Central.

[4] For more on applications built and building using Python, see:  Bahgat, K. (2015) Python geospatial development essentials: utilize python with open source libraries to build a lightweight, portable, and customizable GIS desktop application. [Online]. Birmingham, England; Mumbai [India, Packt Publishing.

[5] For more on weaknesses of Python, see:  Shein, E. (2015) Python for beginners. Communications of the ACM. [Online] 58 (3), 19–21.


Photo of author
About the author
Mark Altaweel
Mark Altaweel is a Reader in Near Eastern Archaeology at the Institute of Archaeology, University College London, having held previous appointments and joint appointments at the University of Chicago, University of Alaska, and Argonne National Laboratory. Mark has an undergraduate degree in Anthropology and Masters and PhD degrees from the University of Chicago’s Department of Near Eastern Languages and Civilizations.