How to fill missing Elevations to empty Contour Lines with PyQGIS

Elevation contour lines without the elevation attribute is common when we import contour lines from Autocad DXF files, but it has also happened that contour data was stored on a hard disk drive without elevation attribute and years later data is found and there is no one to ask to restore the missing information. This tutorial shows a practical procedure to fill missing elevations on contour lines with the use of PyQGIS on QGIS 3. The procedure uses an intersection line that crosses the contour lines where the base elevation and interval is known. There are some specific instructions to run the script that are well described on the video.

Read More

How to Convert a PDF to ESRI Shapefile with Python, Geopandas and Inkscape - Tutorial

In order to use the spatial data provided on a report we need procedures to extract the data on effective way. The amount of tools and techniques are quite advanced, and requires several open source software for specific procedures. We have done a complete tutorial with all the step required to extract the vector spatial data of a map reported as PDF into a ESRI shapefile. For this tutorial we have used Inkscape for the conversion of the PDF to DXF, QGIS to extract some information of the DXF, Python and Geopandas on a Jupyter Lab session for spatial translation and scaling.

Read More

How to convert an ArcGIS Style to QGIS 3 - Tutorial

Spatial data created / processed by commercial or open source software follows standards by institutions like the Open Geospatial Consortium; this standards allow the interoperability of the vector or raster data among different software however standards apply to the position but not the style. Styles from ArcGIS were not easy to convert to formats compatible with QGIS, specially if you don’t have the commercial software.

Governmental offices release spatial data as land use, land cover, infraestructures, and sometimes release styles in ArcGIS formats posing a great obstacle for the QGIS users. This tutorial shows the complete procedure to convert ArcGIS Style to QGIS as *.xml format with a case study of land cover from Costa Rica. The tutorial is developed in Windows, if you are a Linux and Mac users its necessary to install Mdbtools on your own operating system.

Read More

How to get Geospatial Weather Information with QGIS and QWeather - Tutorial

Quick tutorial about how to get geospatial weather data in QGIS using the QWeather plugin. This plugin connects QGIS with the Yahoo Weather API and retrives all information from a location or a lat/long coordinate. Weather data is available for the current day and data is represent as a geojson file.

The tutorial shows the common procedure to retrieve data for capitals and explore the location and metadata information available of precipitation, wind (speed, direction), temperature and humidity. It is possible to setup a defined location list using a .csv file; for the tutorial, main cities in Saxony, Germany were selected.

Read More

View and Manage your QGIS Spatial Data in Android with Q Field - Tutorial

QField is a plugin now in version 1.0 developed by that brings customized maps to a Android devices with the QField for QGIS app. This tutorial shows the complete procedure to create a QGIS project from lines and points with a background map; the project is packed for QField and then ported on a Android device though bluetooth, sd card, usb, or a online service. Once the QField files are on the Android device, the project can be opened with the app and the actual location can be displayed on the screen.

The workflow is fluid and we see high potential in many professional and scientific fields for bringing processed spatial data to fieldwork.

Read More

Land Cover Change Analysis with Python and GDAL - Tutorial

Satellite imagery brought us the capacity to see the land surface on recent years but we haven’t been so successful to understand land cover dynamics and the interaction with economical, sociological and political factors. Some deficiencies were found on the use of GIS commercial software, but there are other limitations in the way we apply logical and mathematical processes to a set of satellite imagery. Working with geospatial data on Python gives us the capability to filter, calculate, clip, loop, and export raster or vector datasets with an efficient use of the computational power providing a bigger scope on data analysis.

This tutorial shows the complete procedure to create a land cover change raster from a comparison of generated vegetation index (NDVI) rasters by the use of Python and the Numpy and GDAL libraries. Contours of land cover change where generated with some tools of GDAL and Osgeo and an analysis of deforestation were done based on the output data and historical images from Google Earth.

Read More

How to clip multiple Landsat 8 Bands with Python and GDAL - Tutorial

Current GIS desktop applications are fully capable of this spatial management and analysis when the amount of raster images is limited; however when we deal with high amount of images the spatial processing on a graphical user interfase (GUI) can be slow and most commonly impractical. The use of programming / processing languages like Python and advanced spatial libraries as GDAL ( helps on the spatial data transformation on a more abstract and effective way. This tutorial shows the complete procedure to clip the complete set of bands from a Landsat 8 image and store them with a suffix on every band file on another folder.

The tutorial is done on a interactive Python programming platform called Jupyter Notebook. The input files: raster bands and area of interest (AOI) shapefile need to be on the same system of reference (SRC), otherwise the GDAL library cannot locate the spatial data on the right position. The tutorial shows the procedure for the whole set of band form a Landsat 8 image, an example for a single band is provided on the scripts of the input data. Finally the tutorial shows the complete and clipped raster on a GIS desktop software as QGIS.

Read More

NDVI calculation from Landsat8 images with Python 3 and Rasterio - Tutorial

Satellite images are georasters, these images are a regular array of columns and rows (a matrix per band) with a georeferenciation. Python is a programming and data analysis language very versatile for the matrix algebra with the Numpy library, however there was no efective and simple way to process a georaster until the development of the Rasterio package.

Rasterio is a library to open, write, explore and analyze georasters in Python. The library uses GeoTIFF images along with other formats and is capable to work with satellite images, digital elevation models, and drone generated imagery.

This tutorial show the complete procedure to analyse the NDVI from a Landsat 8 image with Python 3 and Rasterio. The scripting and representation was performed on a interactive enviroment called Jupyter Notebook, finally the result georaster was opened in QGIS and compared with some background images.

Read More

Sentinel2 images exploration and processing with Python and Rasterio - Tutorial

Rasterio is a Python library that allows to read, inspect, visualize and write geospatial raster data. The library uses GeoTIFF and other spatial raster formats and is capable of working with satellite imagery, digital elevation models, and drone imagery data products. Rasterio allows you to import a single band or multiband geospatial raster in a interactive Python enviroment as Jupyter notebook, the library can keep the “duality” of the geospatial raster, that means, it can handle the location and resolution parameters as well as the matrix values of the gridded elements.

This tutorial shows some basic procedures to explore a multiband Sentinel 2 granule with Python 3 and Rasterio on a Jupyter Notebook. The tutorial shows the commands to identify the raster array dimensions and the geospatial referencing parameters, make representation of each visible band and export band composites as true color and false color geoespatial rasters in Tiff format.

Read More

Elevation Model Conditioning and Stream Network Delimitation with Python and Pysheds - Tutorial

Digital elevation models (DEMs) from satellite interpretation (Aster DEM or Alos Palsar) come with “sinks” from errors in the elevation interpretation, raster resolution or reprojection. There is a need to correct those rasters in order to interpret the hydrological features. This tutorial show the process to condition a digital elevation model (DEM) dowloaded from a NASA/USGS server ( with the Pysheds library of Python. The tutorial was done on a Jupyter Notebook, input files and scripts are attached on the final part of the post.

Read More

How to calculate a Terrain Volume with QGIS3 - Tutorial

Calculate volumes is an easy task on QGIS 3 with the use of SAGA GIS tools under the Processing toolbox. Raster volumes can be calculated above or below a base level and two other specific calculation, input rasters need to be in UTM. These type of calculation is useful for earth movement, reservoir design, risk analysis and other spatial analysis.

The tutorial presented on this post shows the complete procedure to calculate the raster volume above a base level on QGIS3.

Read More

Watershed and Stream Network Delimitation with Python and Pysheds - Tutorial

What would happen if we shift our GIS geoprocessing to Python? What would happen if we treat our raster and vector spatial data as objects and variables on a Python 3 script? Then we can ask ourselves if it is neccessary to reinvent the wheel, it is necessary to change a workflow that already work on a GIS software.

There is a simple answer to this dilemma: More control

Working with Python give us more control on the geoprocessing itself since we leave the Graphical User Interface (GUI) with its icons, buttons and dialog boxes. With Python running on a Jupyter Notebook, we can link with specific files, define geoprocess and it options, make plots of draft and final data, and export results to vector/raster SIG formats. There are other advantages of spatial analysis in Python which are the reproducibility and the processing speed.

Read More

Available QGIS tools and plugins for hydrological modeling - Review

QGIS is viewed as a software for the spatial data processing to create the input data for a hydrogeological modeling as HEC-HMS or RS-Minerve. But, are there any hydrological software that can run on the QGIS interface? There are some half answers and complete answers that we will answer in this article.

Read More

Spatial Manipulation of a Autocad DXF File with Python3 and GeoPandas - Tutorial

In GIS the objects are related to a spatial location. Usually there is no need to modify a location since spatial data comes from field work or other surveys. When we work with CAD files as DXF (Autocad Drawing Exchange Format) files, sometimes the spatial data is available as a layout view and not as a model view. The layout data is on local coordinates, and at specific scale therefore we need to scale and translate the spatial data to “return” it to its original spatial location and extension.

We tried to make this job with Inkscape and QGIS3, but we were unsuccessful to complete the scale and translation. While working with the DXF in Inkscape, each object selection, layer order combination, object ungrouping took several minutes and the results were poor. At the lowest motivational stage of this spatial request, we thought that it might me something in Python that can be useful for this.

On a internet search, we found that the spatial version of the Pandas data analysis library: Geopandas was capable not only to open the DXF files, but also to scale, translate, and filter spatial data according to specific criteria. Geopandas is capable to export spatial data in different formats and to plot data interactively on a Jupyter Notebook.

This tutorial shows the procedure to open a DXF file in Python pandas, perform scale and translation to place the spatial features on their original position, filter unwated objects on the layout view and export results to QGIS3 as shapefile.

Read More

Groundwater Quality Analysis with QGIS3 Tutorial - Case Arsenic in California

Physical process on the surface and underground flow regime are spatially and temporal distributed, therefore the use of GIS software is key to understand the different patterns in groundwater flow and quality and the interaction with surface flow, geology and anthropogenic factors.

QGIS is a open geographical information system (GIS) software that brings a variety of tools for the thematic spatial representation of the groundwater quality components. This tutorial shows a whole exercise of data preparation, color based representation, ruled based representation of points above standars, spatial interpolation and contour representation.

Read More

How to smart download OpenStreetMap spatial data with QGIS3 and QuickOSM

OpenStreeMap (OSM) is a collaborative project to create a world spatial database. This project is motivated by the availability of map information around the world. The database is on continuous growth, it has more than 6.3 thousand million GPS points, around 5 million users and 1 million contributors.

The procedure to download spatial data from OSM has changed from previous QGIS version. Now in QGIS3 there are multiple options to download data from OSM; this tutorial show the installation, and operation of the QuickOSM plugin to perform smart access to the OSM database in QGIS.

QuickOSM works with the Overpass API that was developed to serve up custom selected parts of the OSM map data. This API is optimized for data consumers and it can allow the access millions of elements in some minutes with a specified search criteria (location, object type, tags, proximity or combinations of them).

Read More

Overview of QuickMapServices Plugin for Basemaps in QGIS3 - Tutorial

QGIS 3 has a lot of new features and new tools for geoprocessing and spatial analysis, however there are some tools from QGIS 2 that hasn´t migrated yet. An example of this break was the OpenLayers plugin, one of the most popular and first plugins in QGIS 2 that is not available in the new version of QGIS.

OpenLayers plugin provide maps from Google, OSM and Bing in QGIS 2. Basemaps in QGIS 3 can be inserted as a XYZ Tiles on a process described on this tutorial. However, QuickMapServices plugin allow the search and implementation from a set of basemaps on different formats (TMS, WMS, WFS and GeoJSON) in QGIS 3.

Read More

Basic Example of QGIS - HECRAS Geometry Construction and Flood Simulation

Flow simulation is an important task for engineering and disaster management. From the free softwares available for flow simulation, HEC-RAS is a strong alternative for its continuous development, the capability to simulate many flow types, and the interaction with other softwares like QGIS or MODFLOW.

QGIS is a free and open source software Geographical Information System (GIS) application. There is a environment of available plugins in QGIS that perform specific tasks of analysis, representation and preprocessing. There are QGIS plugins related to HEC-RAS, in this tutorial we will use the Q-RAS plugin to develop a basic example of flow model geometry construction in QGIS and steady flow simulation in HEC-RAS.

Read More

Flood Monitoring Tutorial with Sentinel 2 and Landsat 8 Images in QGIS 3

With current technology and the availability of remote sensing tools through different servers makes it possible to determine or estimate the areas that are flooded or could be, the focus of this tutorial in which a methodology to determine flood zones will be described from the calculation of the NDVI and compare the results with the use of two servers, Sentinel 2 and Landsat 8.

Read More

Vegetation and Biomass Indices Estimation with QGIS 3 - Tutorial

The vegetation indices are obtained from area and satellite images and can be used to estimate changes in the state of vegetation, biomass, leaf area index and chlorophyll concentration. The determination of vegetation indices is calculated from the relationship between the reflectance of the electromagnetic spectrum. While biomass presents various methodologies to be able to estimate that they are based on field measurements that despite being a direct method are still very limited. Currently, the use of remote sensors provides a method to generate information on biomass.

In this tutorial the estimation and relationship of the biomass of a study area with the Normalized Difference Vegetation Index (NDVI) and the Normalized Red-Green Difference Index (NGRDI) will be carried out.

Read More