Thanks, it works!! 2012/2/28 Even Rouault <[email protected]>
> Selon Stefan Röckelein <[email protected]>: > > > Hi, > > > > the usual procedure to open a file with OGR is to use > > OGRSFDriverRegistrar::Open("somefile.dxf",FALSE) > > Now I want to open a DXF-file which was previously stored in a database. > > Therefore I would need some ORG method which reads the drawing not from a > > file, but from a string (containing the whole DXF-file) directly. > > Is it possible to do this somehow? > > > > An alternative could be to save and read an OGRDataSource object inside > the > > database. Is this possible? > > The DXF driver use the CPL Virtual File I/O API, so you can read from a > in-memory file created with VSIFileFromMemBuffer for example ( see > http://gdal.org/cpl__vsi_8h.html#af9c1b931449d423e7a80bacb75ff0717 ) > > The code to use would be something like : > > char* pszTheDXFContent = "a_string_with_the_dxf_file"; > VSILFILE* fpMem = VSIFileFromMemBuffer ("/vsimem/temp.dxf", > pszTheDXFContent, > strlen(pszTheDXFContent), FALSE ); > VSIFCloseL(fpMem); > OGRDataSource* poDS = OGRSFDriverRegistrar::Open("/vsimem/temp.dxf",FALSE); > > /* do something */ > > OGRSFDriverRegistrar::ReleaseDataSource(poDS); > VSIUnlink("/vsimem/temp.dxf"); > > > > > Stefan > > > > >
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
