[gdal-dev] gdal_grid, what am I doing wrong?
dron at ak4719.spb.edu
Tue Feb 19 05:33:57 EST 2008
On Mon, Feb 18, 2008 at 01:57:38PM -0700, Gregor Mosheh wrote:
> What we want is to rasterize it to a TIFF, containing actual data
> values in the pixels, filling in the gaps between these discrete
> sample points with a nearest-neighbor algorithm, and then using a VRT
> for colorization later. gdal_grid seemed the natural tool for this
> purpose, but all I ever get is a TIFF with all 0s across the board.
> What am I doing incorrectly?
> This is an example of a 1-square-degree test swatch.
> gdal_grid \
> -a nearest:radius1=0.0:radius2=0.0:angle=0.0:nodata=0.0 -l depth \
> -outsize 1201 1201 \
> -a_srs EPSG:4326 -tye 31.000000 32.000000 -txe -80.000000 -79.005833 \
> depth.shp depth.tif
You are doing right, but there was a bug in NN interpolation method, so
it does not work as documented. Now fixed in both branches. See here for
Meantime you can workaround this bug using search radius bigger than
your area dimensions, e.g "radius1=2:radius2=2".
> Am I missing the detail of how to tell it which field/column we want
> to use for the pixel value? I didn't see that in gdal_grid's docs, and
> though the shapefile only has one field (field3, the depth) I have a
> feeling that it doesn't know to use that one.
As soon as you added approprite VRT to yuor CSV, there are no "columns"
anymore. ogrinfo shows available layers that you should pick up with the
"-l" option. If you want to check whether everything is working right
use ogrinfo to print layer values for manual control.
Andrey V. Kiselev
More information about the gdal-dev