[gdal-dev] OGR: read datasources from a database
even.rouault at mines-paris.org
Tue Feb 28 07:32:54 EST 2012
Selon Stefan Röckelein <sroeckelein at gmail.com>:
> the usual procedure to open a file with OGR is to use
> 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
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 );
OGRDataSource* poDS = OGRSFDriverRegistrar::Open("/vsimem/temp.dxf",FALSE);
/* do something */
More information about the gdal-dev