Python Programming for GIS Data Processing in QGIS - Script, Module, Package, Library and Framework

Published: 29 October 2022
on channel: Umar Yusuf
619
8

To support me make more contents, BuyMeACoffee at: https://www.buymeacoffee.com/umaryusuf

Source code: https://github.com/forum2k9/Python-Pr...

Script: A file with .py extension that contains variable, functions, classes etc that are intended to run when the file is executed
Example: script_1.py, file1.py, anyname.py etc

Module: it is 'Script' that is intended to be imported into another python script. It usually contains Python objects such as functions, classes, variables, constants, etc.
Example: this, antigravity, math, os, imp, importlib, re

Package: is a collection of 'Modules' in a folder that has a special file named '__init__.py'
Example: pandas, matplotlib, numpy, requests, beatifulsoup etc

Library: A complex 'Package' that contains useful functions
Example: same as packages including... TensorFlow, Keras, PyTorch, Scikit-Learn, Theano

Framework: A complex 'Library' that is used to fast track the development of an application
Example: Flask, Django, FastAPI, Web2Py, CherryPy, PyQt5, Tkinter, Kivy, wxPython, Libavg, PySimpleGUI, PyForms, Wax etc

--------------------- Working with Builtin Modules -----------------------------
Module/Package can only be imported once (however you can reload the import)
Use _file_ to see the module's file path

https://docs.python.org/3/library/ind...
https://docs.python.org/3/py-modindex...
https://docs.python.org/3/tutorial/mo...

--------------------- Working with 3rd Party Modules -----------------------------
Python Package Index - https://pypi.org/
Archived: Unofficial Windows Binaries for Python Extension Packages -
https://www.lfd.uci.edu/~gohlke/pytho...


Python modules/packages/libraries for GIS:-
GDAL/OGR, pyqgis, arcpy, pyproj, rsgislib, geopandas, folium, geemap, ipyleaflet, fiona, rasterio, shapely, pyshp, GeoDjango, geopy etc
For more see: https://github.com/sacridini/Awesome-...
https://github.com/giswqs/python-geos...

--------------------- Creating your own Modules -----------------------------

Ways of importing a module
~ import moduleName
~ from moduleName import variable, function, class
~ from moduleName import *

Rename imported module using the 'as' keyword
~ import moduleName as mn
~ from moduleName import variable as v

Avoiding name collision
~ from math import sqrt
~ from cmath import sqrt

Absolute and Relative
https://www.geeksforgeeks.org/absolut...


On this page of the site you can watch the video online Python Programming for GIS Data Processing in QGIS - Script, Module, Package, Library and Framework with a duration of hours minute second in good quality, which was uploaded by the user Umar Yusuf 29 October 2022, share the link with friends and acquaintances, this video has already been watched 619 times on youtube and it was liked by 8 viewers. Enjoy your viewing!