Markus,<br><br><div class="gmail_quote">On Mon, Aug 24, 2009 at 10:06 PM, Markus Reinhold <span dir="ltr"><<a href="mailto:markus.reinhold@uni-jena.de">markus.reinhold@uni-jena.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hejhej,<br>
please allow me two short questions:<br>
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<br>
(a) analysis of the source dataset and desired band (width, height, pixel size, data type, geotransform),<br>
(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<br>
(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()).<br>
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?</blockquote>
<div><br>I am not sure what all you are trying to do here but the utility program 'gdal_translate' (<a href="http://gdal.org/gdal_utilities.html">http://gdal.org/gdal_utilities.html</a>) may help you. There are some other programs described in that page.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
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?</blockquote>
<div><br>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 <a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/raw/envidataset.cpp">http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/raw/envidataset.cpp</a><br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Thank you very much in advance.<br>
Regards,<br>
Markus<br>
<br>
-- <br>
<br>
********************************************************<br>
Dipl.-Kartograph Markus Reinhold<br>
<br>
Chair of Geoinformatics, Geohydrology and Modeling<br>
Friedrich-Schiller-University Jena<br>
Löbdergraben 32<br>
D - 07743 Jena<br>
Germany<br>
<br>
Phone.: (+49)(0)3641 / 9 488 65<br>
E-Mail: <a href="mailto:markus.reinhold@uni-jena.de" target="_blank">markus.reinhold@uni-jena.de</a><br>
********************************************************<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all">Best regards,<br>-- <br>Chaitanya kumar CH.<br>