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

Noon Silk noonslists+gdal at gmail.com
Sun Oct 28 23:08:49 PDT 2012


Answering my own question, I've found that this is documented here:

 - http://trac.osgeo.org/gdal/wiki/GdalOgrCsharpCompile

I note that it doesn't appear to be included as part of any existing
build/packaging process in the source when I grabbed it
(release-1400).

--
Noon


On Mon, Oct 29, 2012 at 11:13 AM, Noon Silk <noonslists+gdal at gmail.com> wrote:
> Hi Tamas,
>
>  Thanks.
>
>  I'm partly towards getting a build going; but am I to understand that
> generating the SWIG bindings is best done from linux? (That is, I note
> that the code to generate the bindings is in a shell script; I'm
> currently attempting to figure out how to run it, but I'm not sure if
> there is a better way; I.e. I'm running "mkinterface.sh", which I
> found from "mkdgdaldist.sh").
>
> --
> Noon
>
>
> On Mon, Oct 29, 2012 at 4:49 AM, Tamas Szekeres <szekerest at gmail.com> wrote:
>> 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
>>
>>
>
>
>
> --
> Noon Silk
>
> Fancy a quantum lunch? https://sites.google.com/site/quantumlunch/
>
> "Every morning when I wake up, I experience an exquisite joy — the joy
> of being this signature."


More information about the gdal-dev mailing list