Mesh Data Abstraction Library (MDAL) is a C++ library with C API for handling unstructured mesh data released with MIT license. It provides a single data model for multiple supported data formats. MDAL is used by QGIS for data access for mesh layers.
MDAL alternatives and similar libraries
Based on the "Data Structures" category.
Alternatively, view MDAL alternatives based on common mentions on social networks and blogs.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of MDAL or a related project?
Mesh Data Abstraction Library
To discuss development and usage, please use [email protected]
You can use MDAL to load the following file formats:
- 2DM: Mesh representation of various various hydrodynamic modelling packages (e.g. BASEMENT, TUFLOW)
- XMS TIN: Mesh TIN representation in ASCII format
- NetCDF: Generic format for scientific data. Examples can be found here
- GRIB: Format commonly used in meteorology. Examples can be found here
- XMDF*: Outputs of various hydrodynamic modelling packages (e.g. TUFLOW, HYDRO_AS-2D)
- XDMF*: As an example, hydraulic outputs from BASEMENT 3.x modelling package
- DAT: Outputs of various hydrodynamic modelling packages (e.g. BASEMENT, HYDRO_AS-2D, TUFLOW)
- 3Di*: 3Di modelling package format based on CF Conventions
- UGRID*: Unstructured Grid format based on CF Conventions
- FLO-2D: Outputs of the FLO-2D modelling package
- Selafin/Serafin: Outputs of the TELEMAC 2D hydrodynamic modelling package
- HEC-RAS: Outputs of the HEC-RAS modelling package
- SWW: Outputs of the ANUGA modelling package
- Esri TIN: Format for storing elevation data as a triangulated irregular network
- SAGA FLOW**: Rasters in the SAGA flow direction format
- ADCIRC***: ADCIRC hydrodynamic model results
- PLY: Stanford Polygon Format also useful for mesh created from point clouds by PDAL
* Data lazy loaded
** Formats can be preprocessed using QGIS Crayfish Mesh processing algorithm to one of supported formats
*** Results should pre pre-processed to become UGRID compliant
|Format||Mesh Frame Support||Mesh Lazy Loaded||1D Data Support||2D Data Support||3D Data Support||Data Lazy Loaded|
MDAL can be installed as a stand-alone package (i.e. outside of QGIS) using conda.
The package can installed by running :
conda install -c conda-forge mdal
This package provides the MDAL ABI through the mdal shared object( i.e. mdal.dll, libmdal.dylib or libmdal.so) and the mdalinfo CLI.
A friendly note about versions. The conda package is usually targetted at the latest version of GDAL on conda-forge. This is usually a later version than used by QGIS. Therefore, there may be some subtle differences in behaviour when loading e.g. GRIB files.
Versioning and integration in QGIS
QGIS contains internal copy of MDAL library in following versions:
|3.6.3||0.3.2||Many new formats supported|
|3.10.1||0.4.0||Save datasets for some formats|
|3.12.0||0.5.1||3D layered meshes|
|3.16.0||0.7.1||Mesh creation, PLY format|
X.Y.9Z are development versions or alpha/beta releases (e.g.
We maintain the version of MDAL used in current QGIS LTR version. For any CRITICAL bugfixes (e.g. crashes, coredumps, regressions, data corruption) we want to backport the code to MDAL LTR version. To do this, label your pull request with label "backport release-XXX". Once pull request is merged, mdal-bot will automatically create a pull request to specified branch. Note that the pull request must be squashed to 1 commit for automatic backport.
Coding standards & Contribution
MDAL is an open-source project and all contributions to either documentation, format support, testing or code are more than appreciated. Any change to the code must go through Pull Request, followed by review by one of the MDAL core developers.
To be able to accept a pull request, please verify that:
- code follows QGIS coding style
- code is properly unit-tested with a set of small test files under
tests/data/<format>(code coverage > 90%)
- code is reasonably documented and easy to read
- code compiles without any compilation warnings
- no dead-code (e.g. unused functions) or commented out code
- all new code or new dependencies (e.g. libraries) have GPLv2 compatible license
- all tests pass
- the code if properly formated (run
Please respect our [Contributor Covenant Code of Conduct](code_of_conduct.md)
For 64-bit version:
- Install Microsoft Visual Studio 16 2019
- Install OSGeo4W (64bit) to C:\OSGeo4W64
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat -arch=x86"to initialize Visual Studio environment (or open VS terminal). For community version, run similar command
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat -arch=x86"
- Create build directory
mkdir build;cd build
cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Rel -DENABLE_TESTS=ON -DNETCDF_PREFIX="C:\OSGeo4W64" -DHDF5_ROOT="C:\OSGeo4W64" -DGDAL_DIR="C:\OSGeo4W64" -DGDAL_LIBRARY="C:\OSGeo4W64\lib\gdal_i.lib" -DGDAL_INCLUDE_DIR="C:\OSGeo4W64\include" -DLIBXML2_LIBRARIES="C:\OSGeo4W64\lib\libxml2.lib" -DLIBXML2_INCLUDE_DIR="C:\OSGeo4W64\include\libxml2" ..
- Build the executables
cmake --build .
- Adjust the PATH or copy the
- Run the tests
ctest -VV --exclude-regex mdalinfo*
install dependencies for drivers
sudo apt-get install libgdal-dev libhdf5-dev libnetcdf-dev libxml2-dev
and use cmake to generate build system
mkdir build;cd build cmake -DCMAKE_BUILD_TYPE=Rel -DENABLE_TESTS=ON .. make
First you need to install qgis-deps dependencies,
To build, create build system with cmake and make sure you use dependencies from qgis-deps and not system ones
mkdir build;cd build cmake -DCMAKE_PREFIX_PATH=/opt/QGIS/qgis-deps-0.5.3/stage -DCMAKE_BUILD_TYPE=Debug -GNinja -DENABLE_TESTS=ON ../ ninja
run ctest command in build directory
cd scripts ./check_all.bash
or use git pre-commit hook
cd MDAL ln -s ./scripts/mdal_astyle.bash .git/hooks/pre-commit
On Windows, the code can be formatted using the following :
cd MDAL powershell -ExecutionPolicy BYPASS scripts\check_all.ps1
*Note that all licence references and agreements mentioned in the MDAL README section above are relevant to that project's source code only.