<br>
<br>
Am 1. Juni 2017 20:21:21 MESZ schrieb Even Rouault <even.rouault@spatialys.com>:<br>
>On jeudi 1 juin 2017 18:13:00 CEST Kai Muehlbauer wrote:<br>
>> Hi everyone,<br>
>> <br>
>> I'm using python-bindings gdal.Grid() function to grid scattered<br>
>data.<br>
>> <br>
>> I have a in-memory vector point data inside <class<br>
>> 'osgeo.ogr.DataSource'> "ds" which I want to feed directly to<br>
>gdal.Grid().<br>
>> <br>
>> ds2 = gdal.Grid('', ds, format='MEM',<br>
>> width=900, height=900,<br>
>> algorithm=algo,<br>
>> zfield='ZX')<br>
>> <br>
>> Unfortunately I get a "TypeError: in method 'GridInternal', argument<br>
>2<br>
>> of type 'GDALDatasetShadow *'", see complete trace at the end.<br>
>> <br>
>> If I save this dataset as is to an ESRI-Shapefile "test", I can<br>
>> successfully do this:<br>
>> <br>
>> ds2 = gdal.Grid('', 'test', format='MEM',<br>
>> width=900, height=900,<br>
>> algorithm=algo,<br>
>> zfield='ZX')<br>
>> <br>
>> Although I'm happy to get this running that way, I really would avoid<br>
>> the save-to-disc part. Can I somehow fake my <osgeo.ogr.DataSource><br>
>> object to behave like a Dataset object or do some other magic? Any<br>
>hints<br>
>> very much appreciated.<br>
><br>
>gdal.Grid() and other utility-as-a-function requires GDALDataset and<br>
>not <br>
>legacy OGRDataSource,<br>
>so create your vector memory dataset with :<br>
><br>
>ds = gdal.GetDriverByName('Memory').Create('', 0, 0, 0,<br>
>gdal.GDT_Unknown)<br>
<br>
Thanks Even, for the fast response. You mention the OGRDataSource as legacy. <br>
I wasn't aware of that fact. Is there anything important to know about that, because I would need to port quite some code to use the GDALDataset. <br>
<br>
Kai