<div dir="ltr"><div><div>Damian,<br><br></div>I agree that it would be preferable to use a predefined constant. However, I was under the impression that M_PI is a compiler extension and not part of standard C++, so I wanted to make sure it was compatible. If using M_PI is acceptable, I would be happy to change it. I will be submitting my pull request shortly.<br><br><br></div>Taylor<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 27, 2017 at 5:01 AM, Damian Dixon <span dir="ltr"><<a href="mailto:damian.dixon@gmail.com" target="_blank">damian.dixon@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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="m_-9048352380260265557gmail-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-wrap;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-wrap;background-color:rgb(234,255,234)"> </span><span class="m_-9048352380260265557gmail-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-wrap;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-wrap;background-color:rgb(234,255,234)"> PI = </span><span class="m_-9048352380260265557gmail-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-wrap;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-wrap;background-color:rgb(234,255,234)">(</span><span class="m_-9048352380260265557gmail-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-wrap;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-wrap;background-color:rgb(234,255,234)">) * </span><span class="m_-9048352380260265557gmail-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-wrap;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-wrap;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-wrap;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-co<wbr>al/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.co<wbr>m/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/q<wbr>uestions/229952/rotate-envi-hy<wbr>perspectral-imagery-with-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/piperm<wbr>ail/gdal-dev/2013-January/<wbr>035146.html</a><br>
[5] <a href="https://trac.osgeo.org/gdal/ticket/1778" rel="noreferrer" target="_blank">https://trac.osgeo.org/gdal/ti<wbr>cket/1778</a><br>
[6] <a href="http://yceo.yale.edu/opening-aster-files-envi" rel="noreferrer" target="_blank">http://yceo.yale.edu/opening-a<wbr>ster-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=0BxysdOuBmaIGalY5dVhCa1Y5M0<wbr>k</a><br>
______________________________<wbr>_________________<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="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/gdal-dev</a></blockquote></div><br></div>
</blockquote></div><br></div>