[gdal-dev] OGRDataSource::CopyLayer
Ivan Lucena
lucena_ivan at hotmail.com
Tue Jan 28 12:06:19 PST 2014
Even,
> From: even.rouault at mines-paris.org
> To: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] OGRDataSource::CopyLayer
> Date: Tue, 28 Jan 2014 20:50:26 +0100
> CC: lucena_ivan at hotmail.com
>
> Le mardi 28 janvier 2014 19:52:26, Ivan Lucena a écrit :
> > Hi there,
> >
> > I have question/suggestion about that method. When it goes though the loop
> > it calls the driver's CreateField several times, depending on the number
> > of columns on the table. In a DBMS environment, at that point the table is
> > already created and the only thing the driver's CreateField() can do is to
> > issue some ALTER TABLE statements. But that is too time consuming. It
> > takes more time than to load geometry in some cases.
> >
> > Is there a way to pass the field description information to the driver and
> > let it decide to create the table at once with a complete description of
> > the fields?
>
> Ivan,
>
> No, such a method doesn't exist.
>
> One possible solution would be that the implementation of CreateLayer() and
> CreateField() in the driver doesn't do any SQL operation, but just save into
> memory the necessary elements to create the table later. The actual table
> creation would be deferred at the time of the first CreateFeature(),
> BeginTransaction(), or when the layer is destroyed.
I will try that option and see how it goes.
> Another solution would be to introduce a virtual method in OGRLayer -
> CreateLayerWithFields() - that could be specialized in drivers. The base
> implementation would just call CreateLayer() and CreateFields(). CopyLayer()
> and ogr2ogr would need to be retrofitted to use CreateLayerWithFields()
It looks like a very generic problem that might need a general solution in the future.
Thanks!
>
> Even
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140128/e91b40c6/attachment.html>
More information about the gdal-dev
mailing list