[Gdal-dev] swig/perl

Ari Jolma ari.jolma at tkk.fi
Wed Aug 31 18:13:56 EDT 2005


Ken Boss wrote:

>Hello Ari--
>
>I think Howard Butler and Kevin Ruland have already laid much of the groundwork that you'll require with their "next generation" (ng) GDAL bindings project.  See Howard's recent post at http://lists.maptools.org/pipermail/gdal-dev/2005-August/006120.html.
>
>Further, Schuyler Erle did some preliminary work on perl bindings for GDAL a while back (http://search.cpan.org/~sderle/Geo-GDAL/).  I think in particular you might find his typemap work (http://search.cpan.org/src/SDERLE/Geo-GDAL-0.11/typemap) to be of use.
>  
>

Thanks. Well, after a few hours of learning swig, perlguts, etc, I could 
finally get my first "hello world, this is your spatial data:..." 
running. My typemaps_perl.i (which is basically where the porting 
happens) is based on the python one but the internals had to be changed 
of course. "make generate" gives two warnings because it can't apply 
IF_FALSE_RETURN_NONE and "tostring argin" because I just removed those 
typemaps for now. I have a small Makefile.PL (perl standard) which makes 
a Makefile ok but "make -f Makefile" fails saying there are two 
_wrap_GetDriverCount's, the other is of course from OGR. If I fix that 
by hand (edit ogr_wrap.cpp by hand) it compiles. I don't know how to 
control the naming of the _wrap function, %rename does not seem to do 
that. I then have a small test.pl which does gdal::AllRegister, opens a 
GTiff and prints out some info from it, works ok but method names are a 
bit odd: e.g. "$dataset->swig_RasterXSize_get" works but not 
"$dataset->RasterXSize".

Ari




More information about the Gdal-dev mailing list