[gdal-dev] Stuck with python gdal.Grid throwing an error

Even Rouault even.rouault at spatialys.com
Sat Jun 15 00:53:24 PDT 2019


>          err = gdal.Grid(dataset, ds, options=opts)
>          if err != 0:
>              print 'gdalGrid error: ', err
>              return
> 
> The above code is basically the same as what I use for
> gdal.RasterizeLayer() and that worked fine.

gdal.Grid() prototype is

def Grid(destName, srcDS, **kwargs):
    """ Create raster from the scattered data.
        Arguments are :
          destName --- Output dataset name
          srcDS --- a Dataset object or a filename
        Keyword arguments are :
          options --- return of gdal.GridOptions(), string or array of strings
          other keywords arguments of gdal.GridOptions()
        If options is provided as a gdal.GridOptions() object, other keywords 
are ignored. """

So the first argument must be a filename, not a dataset. Only a few utilities 
accept updating an existing dataset. gdal.Grid() will generate a new output 
dataset.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list