<div dir="ltr"><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Hi Taylor,</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">I'm just lurking on the mailing list myself.</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">I had a look at the code changes, as this is one of the formats I'm interested in, and one point springs out at me:</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)">const</span><span style="color:rgb(51,51,51);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)"> </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)">double</span><span style="color:rgb(51,51,51);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)"> PI = </span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)">atan</span><span style="color:rgb(51,51,51);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)">(</span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)">1.0</span><span style="color:rgb(51,51,51);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)">) * </span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)">4</span><span style="color:rgb(51,51,51);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)">;</span><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><span style="color:rgb(51,51,51);font-family:sfmono-regular,consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre;background-color:rgb(234,255,234)"><br></span></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">I find this line potentially a confusing way to define PI, particularly when you combine it with (PI/180) later.</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Personally I would use M_PI.</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Regards</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Damian</div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><br></div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"> <br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 27 February 2017 at 11:55, Taylor Alexander Brown <span dir="ltr"><<a href="mailto:browtayl@oregonstate.edu" target="_blank">browtayl@oregonstate.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Greetings GDAL Community,<br>
<br>
I am developing an application [0] to process georeferenced raster<br>
hyperspectral imagery in ENVI format from NASA's Airborne<br>
Visual/Infrared Imaging Spectrometer (AVIRIS) [1].<br>
<br>
The `map info` section of the header files contain an undocumented [2]<br>
rotation field which is currently ignored by GDAL. As a result, the<br>
image is rotated incorrectly when I process it with `gdalwarp` or the<br>
GDAL Python API. Furthermore, the image is scaled incorrectly when I try<br>
to override the geotransform.<br>
<br>
I documented my experiences on the GIS Stack Exchange [3]. It has<br>
previously been described on the GDAL mailing list [4] and bug tracker<br>
[5]. I believe this issue also affects ASTER imagery [6][7].<br>
<br>
I have implemented a fix based off of branch `tags/2.1.3` and shared my<br>
code on GitHub [8]. It reads the `units` and `rotation` parameter from<br>
the `map info` section and uses these to calculate the geotransform. The<br>
scaling was off because the code expected the `units` parameter to be<br>
the last element in the list, when in my case it was the second to last.<br>
You can verify this behavior with the single-band image I have been<br>
using for testing [9].<br>
<br>
You are welcome to evaluate my code and contribute it back to the<br>
library. I am a novice at both GDAL and GIS, so there may well be<br>
problems. I would be willing to submit a pull request against your<br>
GitHub mirror if desired.<br>
<br>
<br>
Peace,<br>
<br>
Taylor Alexander Brown<br>
<br>
<br>
[0] <a href="https://github.com/capstone-coal/pycoal" rel="noreferrer" target="_blank">https://github.com/capstone-<wbr>coal/pycoal</a><br>
[1] <a href="https://aviris.jpl.nasa.gov/" rel="noreferrer" target="_blank">https://aviris.jpl.nasa.gov/</a><br>
[2] <a href="http://www.harrisgeospatial.com/docs/enviheaderfiles.html" rel="noreferrer" target="_blank">http://www.harrisgeospatial.<wbr>com/docs/enviheaderfiles.html</a><br>
[3]<br>
<a href="http://gis.stackexchange.com/questions/229952/rotate-envi-hyperspectral-imagery-with-gdal" rel="noreferrer" target="_blank">http://gis.stackexchange.com/<wbr>questions/229952/rotate-envi-<wbr>hyperspectral-imagery-with-<wbr>gdal</a><br>
[4] <a href="https://lists.osgeo.org/pipermail/gdal-dev/2013-January/035146.html" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>pipermail/gdal-dev/2013-<wbr>January/035146.html</a><br>
[5] <a href="https://trac.osgeo.org/gdal/ticket/1778" rel="noreferrer" target="_blank">https://trac.osgeo.org/gdal/<wbr>ticket/1778</a><br>
[6] <a href="http://yceo.yale.edu/opening-aster-files-envi" rel="noreferrer" target="_blank">http://yceo.yale.edu/opening-<wbr>aster-files-envi</a><br>
[7] <a href="http://yceo.yale.edu/faq-page#t2n504" rel="noreferrer" target="_blank">http://yceo.yale.edu/faq-page#<wbr>t2n504</a><br>
[8]<br>
<a href="https://github.com/OSGeo/gdal/compare/tags/2.1.3...browtayl:fix-envi-rotation?expand=1" rel="noreferrer" target="_blank">https://github.com/OSGeo/gdal/<wbr>compare/tags/2.1.3...browtayl:<wbr>fix-envi-rotation?expand=1</a><br>
[9] <a href="https://drive.google.com/open?id=0BxysdOuBmaIGalY5dVhCa1Y5M0k" rel="noreferrer" target="_blank">https://drive.google.com/open?<wbr>id=<wbr>0BxysdOuBmaIGalY5dVhCa1Y5M0k</a><br>
______________________________<wbr>_________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/gdal-dev</a></blockquote></div><br></div>