I want to build a DTM. I have extract the ground points from DSM raster by slope base methods and saved in to a raster.tif file.

Now I'm trying to extract ground points from raster.tif as GDAL dataset to use it in the GDAL grid and get my DTM.

But I get this error in using gdalxyz.py:

'gdal2xyz' is not recognized as an internal or external command, operable program or batch file.

What should I do?

2 Answers 2


Can you be more precise with what you are doing? As I understood, since You already have ground points.

  1. Load Ground Points Vector.
  2. Load DSM model.
  3. Get elevation value from raster to points attributes.
  4. Generate raster/TIN from this points using elevation value extracted above.
  5. You will have your required DTM.

You need to run GDAL python scripts from within OSGeo4WShell running python with first parameter as path to py script and add script specific parameters behind:

C:\Program Files\QGIS 3.22.6>python "C:\Program Files\QGIS 3.22.6\apps\Python39\Scripts\gdal2xyz.py"

usage: gdal2xyz.py [-h] [-skip] [-srcwin xoff yoff xsize ysize] [-b band [band ...]] [-allbands] [-csv] [-skipnodata] [-srcnodata [SRC_NODATA ...]] [-dstnodata [DST_NODATA ...]] src_dataset dst_dataset gdal2xyz.py: error: the following arguments are required: src_dataset, dst_dataset

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.