There was a question about processing ungridded .asc DTM files: Problem processing Slovenian LiDAR DTM with GDAL (and QGIS): "too many stepY values" error

The answer helped a lot already, but I don't understand how you calculate -txe and -txy for the gdal_grid command?

When I look into the example file "GK1_444_106.asc", the first point (lower left) is:


and the last point (upper right) is:


I would assume the georeferenced extents of the gdal_grid command would be:

-txe <xmin> <xmax> => -txe 444000.00 444999.96

-tye <ymin> <ymax> => -tye 106000.15 106999.15

But in the answer it is:

-txe 443999.5 445000.5 -tye 106999.65 105999.65
  1. Why was there 0.5 added (to max) and subtracted (from min) to the values (and why were they rounded)?
  2. Why are the -tye values in a reversed order (max first, then min)?
  1. Because 444000.00;106000.15 and 444999.96;106999.15 are the centre of the lower left and upper right pixels whereas the -txe and -tye refer to the extent (i.e. centre +- 1/2 pixel width/depth). The 0.5 is half the 1m pixel size specified in the technical report for the data. This is why the x max value was rounded, so as to maintain a 1m pixel width rather than 0.99996m

  2. I don't know. Because it didn't work with the coordinates in -tye min, max order and resulted in an upside down output. Possibly something to do with the coordinate system but I don't know anything about the D48GK CRS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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