Opened 12 years ago

Closed 12 years ago

#4350 closed defect (fixed)

CopyDataSource doesn't attach driver

Reported by: brfr Owned by: Even Rouault
Priority: normal Milestone: 1.9.0
Component: OGR_SF Version: 1.7.3
Severity: normal Keywords:
Cc:

Description

Hi,

a thing I noticed while using CopyDataSource: the driver is lost, see the short code example below:

Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import ogr
>>> from osgeo import gdal
>>> print gdal.VersionInfo()
1730
>>> in_ds = ogr.Open('points.shp')
>>> in_ds.GetDriver()
<osgeo.ogr.Driver; proxy of <Swig Object of type 'OGRDriverShadow *' at 0x7f919c6f7fc0> >
>>> in_drv = in_ds.GetDriver()
>>> out_ds  = in_drv.CopyDataSource(in_ds, 'cp.shp')
>>> out_ds.GetDriver()
>>> out_drv = out_ds.GetDriver()
>>> out_drv is None
True
>>>

Greetings

Frank

Change History (2)

comment:1 by Even Rouault, 12 years ago

Component: PythonBindingsOGR_SF
Owner: changed from hobu to Even Rouault

comment:2 by Even Rouault, 12 years ago

Milestone: 1.9.0
Resolution: fixed
Status: newclosed
Summary: CopyDataSource doesn't copy driverCopyDataSource doesn't attach driver

r23413 /trunk/gdal/ogr/ogrsf_frmts/generic/ogrsfdriver.cpp: OGR_Dr_CopyDataSource() and OGRSFDriver::CopyDataSource() : make sure that the driver is attached to the created datasource (#4350)

This has exactly the same limitations as #1223 (was about CreateDataSource()) and #2559 (OGR_Dr_Open()), but for the time being, this solution is good enough as we have only one implementation of the virtual method in our source tree!

Note: See TracTickets for help on using tickets.