[gdal-dev] Ogr and Dwg via Teigha (in C#)

Tamas Szekeres szekerest at gmail.com
Sun Oct 28 10:49:32 PDT 2012


Noon,

The C# bindings provided by OGR provide a common interface for all drivers.
You can use the Datasource class for each of the drivers . You can
instatiate the driver by using the driver specific connection string (ie by
using Ogr.Open) or obtain a specific driver (Ogr.GetDriverByName)  and open
the datasource on that (Driver.Open).

You may however need to compile the DWG driver with OGR if that is provided
by default with the binary distribution you are using. According to your
concerns, enabling or not enabling the driver should not affect compilation
of the SWIG interface.

Best regards,

Tamas



2012/10/28 Noon Silk <noonslists+gdal at gmail.com>

> 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
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121028/b931bd0a/attachment.html>


More information about the gdal-dev mailing list