Viewing posts for the category Python


Posted by: Samweli Mwakisambwe | in Python, QGIS | 4 months, 3 weeks ago | Comments

A new QGIS plugin that allows browsing STAC API catalogs inside QGIS has been released. The plugin, developed by Kartoza and sponsored by Microsoft, is available for download and installation in the QGIS official plugin repository. Before this plugin was developed, there was an existing plugin that aimed at providing the same services, though it wasn't updated to use the latest stable release of the STAC API and was not being actively maintained.

Mocking Requests with Responses

Posted by: Zulfikar Akbar Muzakki | in Python | 4 months, 3 weeks ago | Comments

Sometimes, making a request to third-party service is a requirement in our code. And when we test it, those requests could affect the test result i.e. when the service is down, hence causing a test error. It's also a bad idea if our request incurs a cost, like when our code requests a subscription to a third party. If you have read my blog "Mocking Requests with requests_mock", then you would know that all those issues can be solved by mocking our requests in tests using requests_mock. This blog will show you an alternative to requests_mock, the one that is simpler to use yet offers more features: responses. For ease of understanding, the return value from requests will be called "response" and the library that we use is "responses" (i.e. an extra "s" in "responses").

10 Python Tips and Tricks for Beginners

Posted by: Zulfikar Akbar Muzakki | in Python | 5 months, 1 week ago | Comments

What I love most in Python is its readability and ease of use, which makes Python a good language to start in programming. To make Python learning easier, I will list some useful tips and tricks. Please note that I use Python 3.9 and you must have basic Python knowledge to use it properly.

Reading and Writing XLSX File with Openpyxl

Posted by: Zulfikar Akbar Muzakki | in Python | 1 year, 2 months ago | Comments

Openpyxl is a Python library used for manipulating Excel files. I came across a ticket that required exporting data to XLSX format, and I used Openpyxl for that as it’s pretty straightforward.

Python Type-Hint

Posted by: Zulfikar Akbar Muzakki | in Python | 1 year, 3 months ago | Comments

Python is a dynamically-typed language, which means the interpreter does type-checking when the code is executed, and the variable type can change over its lifetime.

Making Django Custom Migrations

Posted by: Zulfikar Akbar Muzakki | in Python | 1 year, 4 months ago | Comments

Working with Django, we must be familiar with makemigrations and the migrate command. We use makemigrations to automatically generate migration files, and migrate to apply them.

Python Mocking Introduction

Posted by: Zulfikar Akbar Muzakki | in Python | 1 year, 5 months ago | Comments

Mocking is a process in unit testing when the test has external dependencies. We isolate our code during the test, without having to worry about the unexpected behavior of the dependencies. For example, we create a routine to save something to Firebase which utilizes 3rd party library called Firestore. There could be problems when saving data to Firebase, like internet connections, wrong configuration, non-existing document, you name it. Instead of testing every possible scenario when saving to Firebase, we only test that Firestore is called with correct parameter, which represents our data. The tests for Firestore itself should have been done by Firestore developer. Hence, we can shift our focus towards the implementation of our code. It also reduces testing time because we don’t need to send our data to Firebase.

Using a Docker Compose-Based Python Interpreter in PyCharm

Posted by: Rizky Maulana Nugraha | in Docker, Python | 1 year, 6 months ago | Comments

I was involved with different kinds of Django projects in the past. Back then the standard approach of attaching your debug interpreter was by creating a virtual environment in your python project. We debugged using PyCharm at that time. JetBrains generously gave us a free licence to use the whole suite of JetBrains tools as their way of supporting open source projects.

Working with Web Data using Requests and Beautiful Soup

Posted by: Zulfikar Akbar Muzakki | in Python | 1 year, 6 months ago | Comments

Imagine us in charge of developing a feature to show public data coming from a third party that doesn’t have an API. Let’s say, we need to show current and historical data of dam water level which we can access at We cannot possibly add the entry manually--it’s too time consuming. Some of us might choose the hard way to ask the data provider to make a public API, but there is a time constraint as we need it as soon as possible. One way to solve this is to use a method called “web scraping”.

Mocking Requests with requests_mock

Posted by: Zulfikar Akbar Muzakki | in Python | 1 year, 7 months ago | Comments

Testing is an important part of software development, be it manual or automated. Untested code is a ticking time bomb ready to explode at the worst time possible, hence each developer must be responsible for testing their code. It’s even better when they make automated tests for their code, even if it’s only unit tests.

Speeding up multiple web map service requests using Python's asyncio and aiohttp

Posted by: Andre Theron | in Python | 1 year, 11 months ago | Comments

Geocontext is a Django app that retrieves information from multiple web based services for a specific query point. The services are arranged into hierarchies with multiple services in a group and multiple groups in a collection. It currently supports querying WMS, WFS & ArcREST services.

Calculating intersects for map layers and map extent dynamically in QGIS

Posted by: Admire Nyakudya | in Python, QGIS | 2 years, 4 months ago | Comments

Recently we have been working on a project that involves simulating the 1 in 50k topographic maps in South Africa. Since we are using QGIS Server to print the map all the logic is set up in print composer. All  maps generated are dynamic (users can select a specific area within South Africa to print) and QGIS Server will use the map template to generate the map. 

FOSS4G 2019 and QGIS in Bucharest

Posted by: Gavin Fleming | in Conference, FOSSGIS, GRASS GIS, GeoNode, GeoServer, Leaflet, PostGIS, Python, QGIS | 2 years, 9 months ago | Comments

Open source GIS is alive and well and continues to grow in leaps and bounds around the world. Why so many Government entities in South Africa continue paying a fortune of tax-payers money for privative GIS and database software beats me, when wealthy, developed countries (as in most of Europe, for example) saw the light years ago and enthusiastically embrace FOSS.

Have any questions? Contact us.
We would love to hear from you!
Subscribe to our Mailing list (spam-free, industry-relevant occasional emails)

Subscribe to our mailing list

* indicates required