[Qgis-developer] Python bindings, GDAL, and SIP file help needed

Peter Ersts ersts at amnh.org
Mon Oct 29 13:28:32 EDT 2007

Martin Dobias wrote:
> I'm glad to see that you're trying to keep bindings up-to-date :)
*trying* being the operative word here ;)

>> The basic SIP layout I have figured out by looking at the other SIP
>> files, but I am running into problems referencing GDAL enums. I need
>> access to GDALDataType, which is in gdal.h. Do I need to make another
>> SIP file for gdal.h?
> In this case I see several possibilities:
> - do not wrap functions which need some external classes/enums
> - wrap also that enum in a sip file
> - replace that enum with some native qgis enum, use that one in functions
> I would prefer the last option as it is the cleanest one. It's better
> to have own types in public API instead of types of some 3rd party
> tools / libraries. Moreover I think that what we would like to reach
> in future is that raster layers implementation would be independent
> from GDAL, so using own data type makes sense...
I don't really see #1 as an medium to long term option. From a python 
perspective it would kind of defeat the purpose of this initial 
refactoring. So I figured I would just try to tackle this issue from the 

I had thought of this last option already and think that looks like the 
better way to go for the time being. I know that GDAL has python 
bindings, but a bit of searching did not end in any information about 
how to use SWIG and SIP together ( I think this is mentioned in a few 
e-mails that followed your initial reponse).

As for not relying on 3rd party tools / libraries, I can only agree with 
this to a point. I think that 3rd party library should be very very 
carefully consider before being used and becoming a dependency. If there 
are only a few methods or the methods are simple enough then yes, they 
should be written natively in QGIS. Otherwise, if the library is well 
written, extensive, well established, and actively being develop, then I 
don't see there being such an issue leveraging that library. If the 
developer pool were to be large enough in the future, then total 
independence could be a long term goal.

Thanks again, I am sure I will have other SIP questions to pass your way!


Peter J. Ersts, Project Specialist
American Museum of Natural History
Center for Biodiversity and Conservation
Central Park West at 79th Street
New York, New York 10024
Tel: (212)-496-3488 or (212)-769-5742
Fax: (212)-313-7295 or (212)-769-5292
Web: http://cbc.amnh.org
Web: http://geospatial.amnh.org

Open Source, Open Mind.
...evolving through community cooperation to change the world bit by bit

More information about the Qgis-developer mailing list