If I want to apply GDAL (version 2.2.3) on the LiDAR derived DTM (ASCII) from Slovenia (Link to Slovenian DTM below), I run into this error:
gdalinfo input.asc
ERROR 1: Ungridded dataset: At line 214, too many stepY values
gdalinfo failed - unable to open 'input.asc'.
The files can neither be loaded into QGIS (3.4.12).
I read here, that there is a XY swap in the files and sort can be used to get rid of the XY swap:
sort -k2 -n -k1 -t ';' input.asc -o output.xyz
However, after applying this to the .asc, I run into the following error:
gdalinfo output.xyz
ERROR 1: Ungridded dataset: At line 1002, too many stepY values
gdalinfo failed - unable to open 'output.xyz'.
What can I do to apply GDAL to the data?
The LiDAR can be accessed for free here: ARSO. Here is a direct download link to a sample ASCII file (D48GK projection): GK1_444_106.asc
Answer
Your data is not a regular grid, you have missing points. The XYZ format description specifies "no missing value is supported".
Below is an image of a small section of the western edge of the data visualised as points showing the missing values.
To convert your data to raster, you can use gdal_grid
. gdal_grid
doesn't support the full range of OGR open options syntax (i.e see the CSV format description) so you need to create a VRT that tells gdal_grid
how to create geometry from the X and Y fields.
CSV:GK1_444_106.asc
wkbPoint
EPSG:3794
You can then use gdal_grid
to output a raster:
gdal_grid -a_srs EPSG:3912 -a nearest -txe 443999.5 445000.5 -tye 106999.65 105999.65 -outsize 1001 1000 -zfield field_3 -l GK1_444_106 GK1_444_106.vrt GK1_444_106.tif
No comments:
Post a Comment