Markus, On Mon, Aug 24, 2009 at 10:06 PM, Markus Reinhold < [email protected]> wrote:
> Hejhej, > please allow me two short questions: > 1) Using the GDAL Python bindings I currently need to extract a single band > from a raster stack and save it in a different format, i.e. ENVI. To achieve > this my processing includes > (a) analysis of the source dataset and desired band (width, height, pixel > size, data type, geotransform), > (b) creation of a temporary in-memory dataset with one band (using > Driver.Create()) that is identical with the desired source band except that > it is all black and > (c) creation of a copy of the temporary dataset (using Driver.CreateCopy()) > and setting it according to the original data (using > RasterBand.ReadAsArray() and RasterBand.WriteArray()). > I found the second step necessary as for ENVI data it is only possible to > create datasets using Driver.CreateCopy() for which a template is needed - > hence the temporary single band dataset... My solution works, I find it a > bit awkward though. Is there a simpler way to do this? I am not sure what all you are trying to do here but the utility program 'gdal_translate' (http://gdal.org/gdal_utilities.html) may help you. There are some other programs described in that page. > > 2) Another question concerning the creation of ENVI datasets with GDAL. I > had been under the impression that *map info* strings for the ENVI header > weren't created when copying another dataset. Now I have found that when the > dataset is in a certain projection and coordinate system, i.e. UTM/WGS84 in > my case, this is done after all. Is there any rule for which configurations > GDAL is able to create a *map info*-section in the ENVI header? I don't know much about the ENVI driver but a glance at the source code shows that 'map info' is hard-coded. You can take a look at the current development snapshot at http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/raw/envidataset.cpp > > Thank you very much in advance. > Regards, > Markus > > -- > > ******************************************************** > Dipl.-Kartograph Markus Reinhold > > Chair of Geoinformatics, Geohydrology and Modeling > Friedrich-Schiller-University Jena > Löbdergraben 32 > D - 07743 Jena > Germany > > Phone.: (+49)(0)3641 / 9 488 65 > E-Mail: [email protected] > ******************************************************** > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev > Best regards, -- Chaitanya kumar CH.
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
