[gdal-dev] crashes at CreateDataSource

Gane R gane.prog at gmail.com
Tue Jan 5 03:01:19 PST 2016


Does the CreateDataSource for filegeodb support filename.gdb with long path
before

CreateDataSource("D:\\temp\\212121\\121212134345\\sample.gdb",NULL);
Gane

On Tue, Jan 5, 2016 at 3:58 PM, Even Rouault <even.rouault at spatialys.com>
wrote:

> Le mardi 05 janvier 2016 11:13:38, Gane R a écrit :
> > Can send the full python script of above so I can verify that I am on
> right
> > track.
>
> Not sure to understand if you ask me to provide the full python script
> (what I
> put in my previous email was the full script) or if you intended to
> provide me
> with a python port of your C++ code.
>
> >
> > Gane
> >
> > On Tue, Jan 5, 2016 at 3:40 PM, Even Rouault <even.rouault at spatialys.com
> >
> >
> > wrote:
> > > Le mardi 05 janvier 2016 10:54:57, Gane R a écrit :
> > > > gdal version gdal-1.11.3 - Filegeodbversion 1.4
> > > > {
> > > > OGRSFDriverRegistrar    *poR;                    //Pointer to hold
> the
> > > > driver registration
> > > > OGRSFDriver                *poDriver;
> > > > OGRDataSource            *poODS;
> > > > OGRRegisterAll();
> > > > poR = OGRSFDriverRegistrar::GetRegistrar();
> > > > poDriver = poR->GetDriverByName("FileGDB");
> > > > poODS = poDriver->CreateDataSource("sample1.gdb",NULL);
> > > > /*
> > > > Here adding layeres and fields and geom
> > > > Finnally closing the dataset OGRDataSource::DestroyDataSource( poODS
> );
> > > > *OGRCleanup not called.*
> > > > */
> > > > }
> > > > *First time the code works fine, and the second time different .gdb
> > > > name the code crashes at createDatasource.*
> > > >
> > > > *This is a snippet of code, I get crash at CreateDataSource second
> time
> > >
> > > for
> > >
> > > > another filename, this code I am trying to put inside a DLL*
> > > >
> > > >  *features created are destroyed.OGRFeature::DestroyFeature(
> poFeature
> > >
> > > );*
> > >
> > > > Do I use the API correctly? any suggestions, What the cause of this
> > > > crash
> > >
> > > Difficult to say without a full reproducer.
> > >
> > > I've just tested the below Python script with the 1.11 branch and
> FileGDB
> > > 1.4
> > > on Linux and it works fine:
> > >
> > > from osgeo import ogr
> > > from osgeo import osr
> > >
> > > for i in range(10):
> > >     ds = ogr.GetDriverByName('FileGDB').CreateDataSource('test%d.gdb'%
> i)
> > >     srs = osr.SpatialReference()
> > >     srs.ImportFromEPSG(4326)
> > >     lyr = ds.CreateLayer('test', geom_type = ogr.wkbPoint, srs = srs)
> > >     lyr.CreateField(ogr.FieldDefn('id', ogr.OFTInteger))
> > >     f = ogr.Feature(lyr.GetLayerDefn())
> > >     f['id'] = 1
> > >     f.SetGeometry(ogr.CreateGeometryFromWkt('POINT (2 49)'))
> > >     lyr.CreateFeature(f)
> > >
> > > --
> > > Spatialys - Geospatial professional services
> > > http://www.spatialys.com
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160105/abe619d4/attachment-0001.html>


More information about the gdal-dev mailing list