[gdal-dev] GDALGrid

Even Rouault even.rouault at spatialys.com
Wed Oct 28 03:00:26 PDT 2015


Le mercredi 28 octobre 2015 10:51:52, Ari Jolma a écrit :
> On 28.10.2015 11:40, Even Rouault wrote:
> > Following the unification, I decided to use only GDALDatasetH even when a
> > vector datasource is expected/output. So you may have to use GDALOpenEx()
> > to open the vector dataset so as to get a GDALDatasetH instead of the
> > legacy OGRDataSourceH.
> > 
> > Or perhaps we could have some tricks at the SWIG level so as to have the
> > possibility to use a OGRDataSourceShadow as well, but I wasn't brave
> > enough to try that so I happily let it to you if you want.
> 
> The same thing is in Rasterize, which is clearly also only for vector
> datasources.
> 
> I know the unification below but it is not in the bindings. 

Well, GDALDatasetShadow has all methods related to Layers, so you can use it 
as a complete replacement of OGRDatasetShadow

> To me it
> looks very simple and working solution to just add
> 
> typedef void OGRDataSourceShadow;
> 
> into gdal.i - similarly as there is already
> 
> typedef void OGRLayerShadow;
> 
> etc.
> 
> and then use OGRDataSourceShadow in those methods, which clearly expect
> vector datasources.

Introducing more - exclusive - uses of OGRDataSource wouldn't really be 
consistant with the unification.
Perhaps as additional possibilities if there's a way of doing so.

> 
> Making the unification in bindings seems much bigger task and I'd
> postpone it.
> 
> How is it in Python bindings? I don't understand how they can be used to
> run Grid without this change.

Well, just use gdal.OpenEx('bla', gdal.OF_VECTOR) and you're done : see 
https://svn.osgeo.org/gdal/trunk/autotest/utilities/test_ogr2ogr_lib.py or  
https://svn.osgeo.org/gdal/trunk/autotest/utilities/test_gdal_rasterize_lib.py

> 
> BTW, I'm making these utilities as methods in the Perl bindings since
> Rasterize is clearly a method for OGR DataSource class and not a
> non-object-oriented subroutine.
> 
> Best,
> 
> Ari

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


More information about the gdal-dev mailing list