[gdal-dev] FW: Function - GDALCreatePansharpenedVRT

Even Rouault even.rouault at spatialys.com
Mon Oct 17 07:14:26 PDT 2016


Jidnyasa,

Please let the list CC'ed (I've re-added it)

> 
> Thanks for the reply. My doubt is if I am having only panchromatic and
> multispectral files as an input how to generate pansharpening vrt without
> using python script as I am trying to use only C++?

Well 2 choices:

1) port 
https://svn.osgeo.org/gdal/trunk/gdal/swig/python/scripts/gdal_pansharpen.py 
to C++. That shouldn't be too hard. It mostly formats the XML of the VRT and 
finally pass it to GDALCreateCopy

2) or perhaps less cumbersome, use the lower level C++ pansharping API of 
alg/gdalpansharpen.h ( http://www.gdal.org/gdalpansharpen_8h.html )

Even

> 
> Thanks & Regards,
> Jidnyasa N
> 
> -----Original Message-----
> From: Even Rouault [mailto:even.rouault at spatialys.com]
> Sent: Monday, October 17, 2016 2:40 PM
> To: gdal-dev at lists.osgeo.org
> Cc: Jidnyasa Nilange <jidnyasa.nilange at advancedriskanalytics.com>
> Subject: Re: [gdal-dev] FW: Function - GDALCreatePansharpenedVRT
> 
> Hi,
> 
> >               I am trying to use  GDALCreatePansharpenedVRT  function
> > 
> > however I am not been able to interpret the argument const char *
> > pszXML
> > 
> >  Which is explained as  "Pansharpened VRT XML where <SpectralBand>
> > 
> > elements have no explicit SourceFilename and SourceBand. The spectral
> > bands in the XML will be assigned the successive values of the
> > pahInputSpectralBands array. Must not be NULL."
> > 
> > 
> > 
> > Can someone please explain me, if this function merely converts the
> > pansharpened VRT  XML to VRT dataset
> 
> Yes
> 
> > or does it actually pansharpens the
> > image using multispectral and panchromatic inputs
> 
> No, you have to read the content of the VRT dataset with GDAL RasterIO()
> API or translate it to another format like GTiff with GDALCreateCopy() for
> example.
> 
> > . If the latter is true
> > please let me know how to generate such an XML and what it should
> > consist of.
> 
> See also
> http://www.gdal.org/gdal_vrttut.html#gdal_vrttut_pansharpen
> 
> And also http://www.gdal.org/gdal_pansharpen.html if you don't need to
> embed that in your program but just run as an external program.
> 
> Even
> 
> --
> Spatialys - Geospatial professional services http://www.spatialys.com

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list