[gdal-dev] Writing Pixel Functions with VRT

Yves Jacolin (free) yjacolin at free.fr
Mon Jan 2 11:45:28 EST 2012


Hello,

Thanks to Even, Brian Case, Joaquim Luis, Etienne Tourigny, antonio (for the 
ticket, patch and lib example) and Frank!

I've suceesfully built my first C++ function and used it with GDAL and QGIS.

Happy new year!

Y.
Le mercredi 21 décembre 2011 21:56:29, Even Rouault a écrit :
> 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.

-- 
Yves Jacolin


More information about the gdal-dev mailing list