Creates an annimated gif from GeoTiff images
Project description
Create annimated GIF from GeoTiff
QGIS
An introduction about using QGIS can be found here.
Installation
- Linux
The script provided here was tested on Ubuntu 22.04:
bash sh.install
This shell script will install all python dependencies using poetry and also install qgis application on Ubuntu, which has a python library need to run the current code.
PyQGIS is (normally) at /usr/lib/python3/dist-packages/
.
Read more about QGIS installation in quickstart.
- Windows
You can download the msi installer in this page.
I'm using the Latest Release
but if you want a more stable version, use Long Term Release
.
After downloading, just proceed with the installation (next-next-install).
Add Google Maps
- Open QGIS
- On the left side, right click on
XYZ Tiles
, and selectNew connection
- Fill in the fields with the appropriate information. It will be similar to the image below.
According to this tutorial, there are different links for the available Google Maps layers:
Layer | Link |
---|---|
Roadmap | http://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z} |
Terrain | http://mt1.google.com/vt/lyrs=p&x={x}&y={y}&z={z} |
Altered roadmap | http://mt1.google.com/vt/lyrs=r&x={x}&y={y}&z={z} |
Satellite only | http://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z} |
Terrain only | http://mt1.google.com/vt/lyrs=t&x={x}&y={y}&z={z} |
Hybrid | http://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z} |
Testing
The following line tests the standalone implementation (i.e., you don't need to open QGIS) that reads a set of three geotiff images using pyQGIS, saves them as png files and also output an annimated gif with all three. This set contains the original image, the ground truth and the prediction maps.
Calling it on Windows
& 'C:\Program Files\QGIS 3.36.3\apps\Python312\python.exe' qgis_annimated.py --base images/Greece_2_hsi.tif --gt images/Greece_2_gt.tif --prediction images/Greece_2_prediction.tif
All paths shown here refers to my computer. You must change them accordingly.
This example uses the sample image in the images
folder.
Check the program parameters issuing:
& 'C:\Program Files\QGIS 3.36.3\apps\Python312\python.exe' qgis_annimated.py --help
DEBUG:root:adding to sys.path: C:/Program Files/QGIS 3.36.3 Usage: qgis_annimated.py [OPTIONS] Options: --base TEXT Path to the real geotiff image [required] --gt TEXT Path to the ground truth geotiff image [required] --prediction TEXT Path to the predictions geotiff image [required] --output TEXT Path to save the png and gif images --debug / --info set logging level to debug or info (default) --help Show this message and exit.
The resulting gif is shown here.
Calling PyQGIS on Ubuntu
The code was tested on Ubuntu 22.04 with the default Python 3.10.12 installed. After installing QGIS as described in Debian/Ubuntu Quickstart, you will see that python-qgis is also installed. You can check the version using the following command inside python3 prompt
>>> import qgis.utils >>> qgis.utils.Qgis.QGIS_VERSION '3.22.4-Bialowieza'
Create GIF
You can call the program using:
cd moviq_qgis
poetry shell
python3 -m moviq_qgis --base images/Greece_2_hsi.tif --gt images/Greece_2_gt.tif --prediction images/Greece_2_prediction.tif
It will read the 3 images provided in the arguments, convert them to PNG and save these images on results
. Those 3 PNG images are them merged in an annimated GIF, which will be also saved on results
.
Distribute
You can use poetry
to create the distribution (wheel) package to install in another project, e.g., moviq-segmentation.
cd moviq_qgis
poetry build
After running the command above, it will create in the folder dist
a package moviq_qgis-0.1.0-py3-none-any.whl
that you can install.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file moviq_qgis-0.1.0.tar.gz
.
File metadata
- Download URL: moviq_qgis-0.1.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e00fa47879f81a4b5f1de4d403d2d4814a4bf0d31fa0fcedc281d699c5dd813e |
|
MD5 | 0296569cf7e0b6d12fe2f23ac8fdd223 |
|
BLAKE2b-256 | 910171b1cbd0919da44a8d9ccc6f9bac894a0ae0c5f86200ad7fcc46926b6792 |
File details
Details for the file moviq_qgis-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: moviq_qgis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af836f8ed72695ded5d002c8213ecb684db8a088c986f33a520086e464451272 |
|
MD5 | a3a5f20a5d2b85cf62d15b5874c1b3a6 |
|
BLAKE2b-256 | c1d263d05041cfb3b2a2de3cc9737ad6ac2b943c8bab192d8cc1fba12e12c7bf |