I have a series of text files that represent X,Y,Z elevation data. I'm trying to use the GDAL grid command line tool to convert these text files to raster GeoTIFs. My files are space delimited and so I have created VRT files that point to the data so that GDAL can read them OK. The VRT files work. I can load the layers into QGIS and I can use ogrinfo to describe the data OK.
Many of my text data files convert to raster just fine. These are typically longer files with > 10,000 lines of data. However, my small files (< 5,000 lines) produce a raster with only NoData values.
I am using the
linear algorithm. My points are evenly spaced at 1m and I've tried several radius values. The command that I'm using is:
C:/OSGeo4W64/bin/gdal_grid.exe -ot Float32 -of GTiff -txe 239982.0 240207.0 -tye 647659.0 648667.0 -outsize 225 1008 -a linear:radius=1 D:\Temp\19900928.vrt D:\Temp\19900928.tif
I've also tried the nearest neighbour algorithm and get some weird, partial values in the output GeoTiFF for these small files.
A sample source text file is available here:
The corresponding VRT file is:
<?xml version="1.0" ?> <OGRVRTDataSource> <OGRVRTLayer name="elevation_points"> <SrcDataSource>CSV:D:\Temp\elevation_points.txt</SrcDataSource> <SrcLayer>elevation_points</SrcLayer> <GeometryType>wkbPoint</GeometryType> <LayerSRS>EPSG:2762</LayerSRS> <GeometryField encoding="PointFromColumns" srs="EPSG:2762" x="field_2" y="field_3" z="field_4"/> </OGRVRTLayer> </OGRVRTDataSource>
Can anyone help and figure out how to make GDAL grid produce a raster from these data please?