My Authors
Read all threads
In the following days I am going to start a series of #QuarantineGIS twitter threads.This first one is about #Python and #GIS and I will talk about the 𝗣𝘆𝘁𝗵𝗼𝗻 𝗳𝘂𝗻𝗱𝗮𝗺𝗲𝗻𝘁𝗮𝗹𝘀 you need to start GIS programming. But first, a couple of important notes. 1/12
First, you need to be familiar with the command line. Also, choose the best text editor for the task. @pycharm is commonly used by Python developers, but if you are coding in several languages, @code could be a better fit. Some of its extensions will make your life easier. 2/12
Second and most importantly, you must master the basics. Don't go directly to code GIS scripts without understanding the fundamentals. IMHO data structures, functions and arguments, working with files, paths and environment variables are a must. 3/12
There are also a couple of very nice features that will simplify significantly your code: list comprehensions and f-strings. The 1st allows you to translate a for-loop block into just one line of code when iterating an object, a list or a tuple. 4/12
The 2nd feature helps us to insert directly a variable into a string, something similar to JS string literals. Should we say goodbye to for-loops and the string format method? Not always. Remember that your code should be first and foremost, legible. 5/12
Now that we are talking about clean code. I highly recommend reading this article. At the very bottom (but please read it all!), there is a guide for installing and using flake8 or other similar tools. These will help you to check if your code is following the standards. 6/12
OK, let's start. Virtual environments. Every time you start a new project, please give you a favor: create a new venv. In doing so, your project will be isolated and will only rely on your requirements. 7/12 realpython.com/python-virtual…
I would recommend using IPython instead of the regular Python interpreter. If you are familiar with Jupyter notebooks (we will cover this in a next thread), IPython uses the same interface but without leaving the command line. 8/12
Logging better than printing. I am sure you have read it before. Knowing what is going on inside your scripts is key to understanding where and why your code is failing (because it will fail!). This old guide explains logging in a very nice way. 9/12 fangpenlin.com/posts/2012/08/…
Finally, you must learn to work with APIs in Python. Most GIS web services have an API to provide data or any other service. If you don't know what I am talking about, watch this introductory course from @freeCodeCamp in Youtube. 10/12
Once you understand the language of APIs (I also recommend practicing with @getpostman), there are a couple of Python packages that you have to master: requests and json. The first will help us to make API calls and get responses. 11/12
The second will allow us to convert and parse these responses into data structures that our scripts and applications understand. Differentiating these two methods, dumps (json → string) and loads (string → json) is a must. 12/12 educative.io/edpresso/what-…
You can read this thread in Spanish here 👇
Missing some Tweet in this thread? You can try to force a refresh.

Enjoying this thread?

Keep Current with Ramiro Aznar

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!