[gdal-dev] VRT creation from Python, adding existing geotiff as bands

Anton Korosov anton.korosov at nersc.no
Mon Feb 16 06:11:53 PST 2015


Dear Rémi,

you may want to look at our Python package NANSAT 
(https://github.com/nansencenter/nansat) which we build around the GDAL 
and especially VRT. We even have a separate class VRT() for creating, 
changing and using VRT files.
More specific regarding your question, you can try to use the 
SourceTransferType parameter of the VRT. Search for this keyword at
http://gdal.org/gdal_vrttut.html

Regards!
Anton

On 16/02/15 14:13, Rémi Cura wrote:
> Hey dear list,
> this is my first post here,
> so sorry if I'm asking something obvious.
>
> (I noticed the 2 previous mail thread regarding python and VRT).
>
> I wrote python functions to convert a numpy structured array to several
> gdal rasters.
>
> A numpy structured array is a 2D pixel array, but each pixel has in fact
> several values of possibly different type (like band).
> For instance a pixel dtype can be [float32,uint16,Float64].
>
> I want to convert this array to raster(s).
> First I tried to create one raster with several bands,
> but GeoTiff cannot handle bands with different pixel type (or I didn't
> find how).
>
> I concluded that I must create several rasters, and put them all as
> bands in a VRT.
>
> So far I have been able to create several geoTiff raster of various type
> corresponding to the numpy structured array.
>
> Now, I don't know how to create from python the VRT that unites all this
> rasters.
>
> When I try to write in a VRT raster band I get errors.
>
> I am well aware that I could create the XML directly from python, but it
> feels like a pretty bad architecture idea.
>
> Anybody knows how to do this /and/or has comments about this task?
>
> Many Thanks,
> Rémi-C
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



More information about the gdal-dev mailing list