[gdal-dev] Writing Pixel Functions with VRT

Even Rouault even.rouault at mines-paris.org
Wed Dec 21 15:56:29 EST 2011


Le mercredi 21 décembre 2011 21:51:57, Yves Jacolin (free) a écrit :
> Le mercredi 21 décembre 2011 21:44:14, Even Rouault a écrit :
> > Le mercredi 21 décembre 2011 20:41:04, Yves Jacolin (free) a écrit :
> > > Hello,
> > > 
> > > I have some question about writing pixel functions with vrt files. I
> > > have a netcdf file with two subset named U and V.
> > > 
> > > How can I process sqrt(U^2 + V^2) using this feature with vrt file?
> > > 
> > > * do I need to create a C file and build GADL with it?
> > > * do I need to create a C file and locate it close to vrt file?
> > 
> > It depends on how you want to use those pixel functions. If it is in an
> > application in C/C++ that you develop and that uses GDAL, then it is
> > sufficient to place the pixel function in your code and register it.
> > 
> > If you want the pixel functions to be usable by existing GDAL utilities
> > or third-party programs using GDAL (QGIS...), then a solution is to
> > create a small shared library that will be loaded as a GDAL plugin. See
> > http://trac.osgeo.org/gdal/ticket/3367 that has already a few functions.
> > 
> > You just need to make sure that the plugin is accessible through
> > GDAL_DRIVER_PATH environmenet variable. No need for it to be close to the
> > VRT file.
> > 
> > Or you can indeed hack GDAL itself and add it and register it.
> > 
> > > Thanks,
> > > 
> > > Y.
> 
> interesting it seems we can use Python pixel functions.

I didn't dare to mention it because it is a bit geekie. You must use ctypes to 
load libgdal and then define manually each C function used. A bit more involved 
than the use of the typical GDAL Python bindings.

> 
> Y.


More information about the gdal-dev mailing list