[gdal-dev] Python bindings for a GDAL dependent library

Idan Miara idan at miara.com
Thu Jun 25 12:28:38 PDT 2020

Thanks for your reply!
Say I am implementing some raster processing algorithm in c++ (thus using
gdal c api to load the input and to create an output ds) and want to write
python code that takes the result and post process it (say use gdal_calc.py
to combine some results of that function).

I was able to save the result raster to a file in c++ (through a python
call) and load the file in python (via gdal python api), but I want to
avoid using the intermediate file and just use the same instance of a ds.

On Thu, 25 Jun 2020, 22:21 Andrew Bell, <andrew.bell.ia at gmail.com> wrote:

> On Thu, Jun 25, 2020 at 2:40 PM Idan Miara <idan at miara.com> wrote:
>> Hi all,
>> I am writing a C++ library with a C API that links to GDAL dynamically
>> with LoadLibrary.
>> I would like to access the C API via Python and I have a few questions.
>> Currently the library compiled with MSVC and I was able to access some
>> functions from python via SWIG but I didn't try to pass GDAL types back and
>> forth.
>> 1. How do I make my library open the same instance of GDAL dll that is
>> used by the GDAL Python bindings?
> 2. Are the SWIG bindings written manually for every new C function or is
>> there an semi/automated way to create it?
>> 3. Is there an example for a library that creates gdal datasets in C/C++
>> and sends them to Python (or the other way around) to continue the process?
>> any best practices?
> Maybe an example of what you're trying to do would be helpful.
> If you're writing your code that's calling GDAL from C++, why are you
> concerned about Python bindings?
> --
> Andrew Bell
> andrew.bell.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200625/1210c8c4/attachment.html>

More information about the gdal-dev mailing list