Mesh2Raster
Introduction
This utility generates an ASCII-raster file based on a 2D surface mesh. A raster is superimposed on the mesh and pixel values are set to the surface elevation at each pixel’s position. If no mesh element is located beneath a pixel it’s value is set to NODATA.
Usage
Mesh2Raster -i <string> -o <string> [-c <real>]
Where:
-i <string>, --input-file <string>
(required) Mesh input file (*.vtu, *.msh)
-o <string>, --output-file <string>
(required) Raster output file (*.asc)
-c <real>, --cellsize <real>
edge length of raster cells in resultThe parameter c specifies the cell size (i.e. pixel size) of the raster. While optional, it is still recommended to choose a value as the default will be set to the minimum edge length in the input mesh which for unstructured grids may result in a very fine and (extremely) large output raster.
Simple example
Input data:
The input mesh for this example is a homogeneous, unstructured triangle mesh with an average edge length of 100m.
Command:
Mesh2Raster -i input.vtu -o output.asc -c 50
Command:
Mesh2Raster -i input.vtu -o output.asc -c 200
Command:
Mesh2Raster -i input.vtu -o output.asc -c 1000
Application
The resulting ASCII-rasters can be used to represent surface data in geographic information systems. In the absence of input data, a detailed raster can also be used by OpenGeoSys preprocessing tools to generate new surface meshes with different resolution or properties.
This article was written by Karsten Rink. If you are missing something or you find an error please reach out
to us on our forum.
Generated with Hugo 0.164.0
in CI job 825193
|
Last revision: April 20, 2026
Commit: refactor(MeshLib): remove PropertyVector::push_back 870422dde
| Edit this page on