[gdal-dev] Ogr and Dwg via Teigha (in C#)
Noon Silk
noonslists+gdal at gmail.com
Sun Oct 28 03:43:00 PDT 2012
Hi All,
I'm trying to read DWG files and output OGR layers. I note, actually,
that there exists an OgrDwgDatasource in the C++; but I don't believe
it is built by default.
My difficutly comes in in that I'm using the SWIG-generated bindings.
I tried porting the C++ datasource code to C#, but stumbled upon a
problem - SWIG hadn't generated a usable OSGeo.OGR.DataSource. The
problem is, when you want to implement your subclass, you need to pass
some information to the constructor that you can't obtain (i.e. a new
instance of the DataSource). The reason why, I suppose, is that SWIG
hasn't even generated a newDatasource() method. So I find myself
wondering why, and being a bit confused.
I think basically I must be approaching this wrong. I'm supposing
what I should do is to compile OGR with DWG support (i.e. use the
OgrDwgDataSource.cpp that exists in ogr_frmts/dwg) and then have it
generate SWIG bindings from here. My concern with this is that,
glancing at the build scripts, it looks like it will work with
"DWGDirect", which I think is a precursor to Teigha. So I'm slightly
concerned that following this path will lead to build difficulties.
I suppose my question here is; what is the standard way to do this? I
would like to make use of the stuff already pre-written in Ogr to do
this, but I could be convinced that it's just better to approach it
from the Teigha side; converting to OGR myself. But of course I'd far
prefer just to simply change a small build parameter, get all the
correct SWIG bindings, and then just perform everything in C# ...
Appreciate any thoughts.
--
Noon
More information about the gdal-dev
mailing list