How I Stumbled into Python Programming

Joseph Kariuki
5 min readJun 16, 2023

--

I believe that Python is relevant to learn in 2023 and beyond. This is not about the species of snake, but Python, the versatile programming language.

Stumbling into Python
Stumbling into Python

Starting the Journey

Growing up with video games like the brick game and Ending Man gaming consoles kind of influenced my interests towards computers. Today I am not much of a gamer as I was a few years back but I do not see it a waste of time.

One of my favorites subject of study was Geography and coupling this with traveling to the countryside, equally influenced my interest on the subject. Which is why I decided to pursue a course that had a combination of geography related subject and informatics, Geospatial Engineering.

Through my studies at the university, I hated mathematics, but did not have much of a choice but to study it, at least to pass my examinations at the time. I was more active in local community meetups that incorporated students such as the Google Map Maker challenge and HERE Maps community and this is where I began having a different perspective out of the classroom.

Some of the meetups, which were back in 2012 and 2013 were usually held at iHub and later on NaiLab which were (still are I guess) startup incubators. I learnt a lot from these meetups and it is a this time that I started hearing of Python programming, a cool scripting language that was gaining popularity in place of C++ and Java which were, at the time being taught at the university, at least for anyone who was pursuing Computer Science.

I started doing some research online on what Python was and gathered some information. I did a unit in programming but we were using Matlab and Java and which was rather short covering one out of 10 semesters but gave me the basics covering variables, object oriented programming, and encapsulation. Later on, when pursuing Geographic Information Systems (GIS), I realized most of the software and tools that we were using at the time had some component developed in Python. Some of the software used included ArcGIS Desktop (currently ArcGIS Pro), QGIS Desktop, GRASS and AutoCAD Land Desktop (currently AutoCAD Civil 3D).

Scripting in GIS

In 2014, we began using ArcGIS Desktop 10 and QGIS for most of the practical work, both of which had a Python console menu somewhere in their menu or tool bars. I made good use of both in-built and online documentations for each software to experiment the extents of Python in GIS programming beyond the classwork and assignments. At this time I could write short Python snippets and functions that could perform simple tasks.

I used Python to create maps and connect to the internet among other tasks. The libraries that I mostly used in ArcGIS (version 10/10.1), using Python 2.6/2.7 included:

  • ArcPy
  • Matplotlib
  • Numpy

For Python versions used in different versions of ArcGIS, refer to this link. In QGIS Desktop (version 2.10, code name ‘Pisa’), which was used less often as compared to ArcGIS, I made use of :

  • PyQt4
  • Numpy

I learnt that programming is not easy especially when it came to writing many lines of code performing some task. I was also confused at which point one would introduce classes and methods (concepts of OOP) since I had only been taught the concepts in theory in one semester. However, I was able to create scripts that performed the following:

  • Reading and displaying data from an ESRI Shapefile, in QGIS and ArcGIS
  • Showing a widget with menu items in QGIS
  • Removing layer from the map canvas in QGIS

Over time I was able to gain confidence in writing scripts that perform some logical tasks in these two desktop GIS environments.

Employment

In 2015, I was among the first students to obtain an opportunity for industrial attachment (similar to internship) at ESRI Eastern Africa. My enthusiasm for GIS and computer programming enabled me to get this opportunity.

I was assigned basic GIS tasks such as analysis, visualization and publishing of location-based data and map production through which I was able to work with ArcGIS JavaScript Application Programming Interface (API) for the web while using ArcPy and matplotlib on the desktop environment.

I was able to create geo-processing tasks which included filtering features in a vector layer, labeling, styling and exporting features to shapefiles using ArcPy.

I began working as a GIS technical intern in 2016 where I used Django, a robust web back-end framework for Python for most of my time. My interest in Python shifted from enterprise to open-source tools and libraries and their capabilities. In the same year, after learning Django for a few months, I made a presentation on the annual GIS Day on using Django Leaflet which can be accessed on slideshare.

FOSS4GE 2017

In July 2017, I attended the annual Free and Open Source Software for Geospatial Europe (FOSS4GE) where I interacted with the open source GIS community and learnt a lot including the capabilities of Python programming with regard to GIS.

Various developers had come up with visualization dashboards, some of which rendered 3D data, performing data filtering on-the-fly and publishing data across the web. Some of the software and tools that were presented were being supported by Python in the back-end and this too fired up my enthusiasm to continue learning Python and aspire developing tools that solve problems both at home and beyond.

Conclusion

To summarize, since 2016 to-date, I have been actively using Python in the following:

  • Developing interactive desktop GUIs using PyQt5 and PyQGIS
  • Creating web applications using Flask and Django
  • Manipulating data using NumPy, SciPy, PyGDAL and GeoPandas

I wrote this post of my journey into Python to encourage anyone who is beginning learning Python programming or any other language not to stop. I did not pursue computer science or software engineering courses but over the years, I have taken the challenge to learn these concepts out of interest and passion and I am still learning and improving my coding skills.

For more on my personal projects and contributions to open source using Python, visit my GitHub profile

I will share some resources for learning Python programming language in future post.

--

--

Joseph Kariuki
Joseph Kariuki

Written by Joseph Kariuki

Geospatial engineer transitioned into software developer catch me at https://josephkariuki.com Content: https://linktr.ee/josephkariuki

No responses yet