Correcting ColorInterp on Jpeg2000 NAIP imagery using .aux.xmlTilecache positions my gdal_translated map 20km south of where I want itUnderstanding the Map Tile creation propertiesRasterize shapefile to a new gtiff file with gdal_rasterize utility,however,I cannot open the tif file?Convert grey,green,blue to red,green,blue tiffHow to remove compression from jpeg2000 NAIP imagery?Add hillshade to naip imageryGetting origin as long, lat in GDAL without knowing EPSGHow can a make a netcdf with subgroups smaller?Trying to store Metadata in GeoPDFWriting no_data_value within jpeg2000[kdu] with gdal_translate

Proof of work - lottery approach

Do sorcerers' Subtle Spells require a skill check to be unseen?

Why escape if the_content isnt?

How do I extract a value from a time formatted value in excel?

Is expanding the research of a group into machine learning as a PhD student risky?

Purchasing a ticket for someone else in another country?

Is this apparent Class Action settlement a spam message?

Avoiding estate tax by giving multiple gifts

How to write papers efficiently when English isn't my first language?

Class Action - which options I have?

Is there a problem with hiding "forgot password" until it's needed?

How to pronounce the slash sign

Roman Numeral Treatment of Suspensions

How can we prove that any integral in the set of non-elementary integrals cannot be expressed in the form of elementary functions?

What can we do to stop prior company from asking us questions?

Sort a list by elements of another list

What happens if you roll doubles 3 times then land on "Go to jail?"

How long to clear the 'suck zone' of a turbofan after start is initiated?

How easy is it to start Magic from scratch?

Is HostGator storing my password in plaintext?

Increase performance creating Mandelbrot set in python

Why are there no referendums in the US?

Why Were Madagascar and New Zealand Discovered So Late?

What is the difference between "behavior" and "behaviour"?



Correcting ColorInterp on Jpeg2000 NAIP imagery using .aux.xml


Tilecache positions my gdal_translated map 20km south of where I want itUnderstanding the Map Tile creation propertiesRasterize shapefile to a new gtiff file with gdal_rasterize utility,however,I cannot open the tif file?Convert grey,green,blue to red,green,blue tiffHow to remove compression from jpeg2000 NAIP imagery?Add hillshade to naip imageryGetting origin as long, lat in GDAL without knowing EPSGHow can a make a netcdf with subgroups smaller?Trying to store Metadata in GeoPDFWriting no_data_value within jpeg2000[kdu] with gdal_translate













1















Using GDAL 2.4.0 with OpenJPEG 2000 v2.3.0.



gdalinfo reports all four bands of NAIP imagery as "Unknown" colorinterp. Sample image here: https://prd-tnm.s3.amazonaws.com/StagedProducts/NAIP/id_2015/46115/m_4611501_sw_11_1_20150702_20151207.jp2



This messes up apps like mapserver, which are then unable to serve out color images.



I attempted to add colorinterp information via an .aux.xml sidecar file. Gdalinfo reports that the sidecar file is detected and read, but the colorinterp is still unknown. Sidecar file contents below (what is shown is the entire file).



Googling around, I see reference to the openjpeg2000 driver using the sidecar file for georeferencing, but no mention of using it for colorinterp metadata. Can I fix the colorinterp using a sidecar file?



I know I can fix colorinterp by doing gdal_translate, but I have an awful lot of these files (~4TB), and any gdal_translation produces files 3x - 4x bigger. I want to avoid having the files get that big. I suspect the commercial encoders USDA is using are better than OpenJPEG2000, so I'd love to just leave the files alone and interpret the existing bands correctly. How would I do that?



<PAMDataset>
<PAMRasterBand band="1">
<ColorInterp>Red</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="2">
<ColorInterp>Green</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="3">
<ColorInterp>Blue</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="4">
<ColorInterp>Grey</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>









share|improve this question







New contributor




Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I guess that the real problem is not with colorinterpretation but with the 4 band source data. Select the bands which you want to use for the RGB presentation with for example PROCESSING "BANDS=1,2,3".

    – user30184
    Mar 24 at 12:16











  • genius! can you make that an answer so I can accept it?

    – Bryce Nordgren
    2 days ago















1















Using GDAL 2.4.0 with OpenJPEG 2000 v2.3.0.



gdalinfo reports all four bands of NAIP imagery as "Unknown" colorinterp. Sample image here: https://prd-tnm.s3.amazonaws.com/StagedProducts/NAIP/id_2015/46115/m_4611501_sw_11_1_20150702_20151207.jp2



This messes up apps like mapserver, which are then unable to serve out color images.



I attempted to add colorinterp information via an .aux.xml sidecar file. Gdalinfo reports that the sidecar file is detected and read, but the colorinterp is still unknown. Sidecar file contents below (what is shown is the entire file).



Googling around, I see reference to the openjpeg2000 driver using the sidecar file for georeferencing, but no mention of using it for colorinterp metadata. Can I fix the colorinterp using a sidecar file?



I know I can fix colorinterp by doing gdal_translate, but I have an awful lot of these files (~4TB), and any gdal_translation produces files 3x - 4x bigger. I want to avoid having the files get that big. I suspect the commercial encoders USDA is using are better than OpenJPEG2000, so I'd love to just leave the files alone and interpret the existing bands correctly. How would I do that?



<PAMDataset>
<PAMRasterBand band="1">
<ColorInterp>Red</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="2">
<ColorInterp>Green</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="3">
<ColorInterp>Blue</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="4">
<ColorInterp>Grey</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>









share|improve this question







New contributor




Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I guess that the real problem is not with colorinterpretation but with the 4 band source data. Select the bands which you want to use for the RGB presentation with for example PROCESSING "BANDS=1,2,3".

    – user30184
    Mar 24 at 12:16











  • genius! can you make that an answer so I can accept it?

    – Bryce Nordgren
    2 days ago













1












1








1








Using GDAL 2.4.0 with OpenJPEG 2000 v2.3.0.



gdalinfo reports all four bands of NAIP imagery as "Unknown" colorinterp. Sample image here: https://prd-tnm.s3.amazonaws.com/StagedProducts/NAIP/id_2015/46115/m_4611501_sw_11_1_20150702_20151207.jp2



This messes up apps like mapserver, which are then unable to serve out color images.



I attempted to add colorinterp information via an .aux.xml sidecar file. Gdalinfo reports that the sidecar file is detected and read, but the colorinterp is still unknown. Sidecar file contents below (what is shown is the entire file).



Googling around, I see reference to the openjpeg2000 driver using the sidecar file for georeferencing, but no mention of using it for colorinterp metadata. Can I fix the colorinterp using a sidecar file?



I know I can fix colorinterp by doing gdal_translate, but I have an awful lot of these files (~4TB), and any gdal_translation produces files 3x - 4x bigger. I want to avoid having the files get that big. I suspect the commercial encoders USDA is using are better than OpenJPEG2000, so I'd love to just leave the files alone and interpret the existing bands correctly. How would I do that?



<PAMDataset>
<PAMRasterBand band="1">
<ColorInterp>Red</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="2">
<ColorInterp>Green</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="3">
<ColorInterp>Blue</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="4">
<ColorInterp>Grey</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>









share|improve this question







New contributor




Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












Using GDAL 2.4.0 with OpenJPEG 2000 v2.3.0.



gdalinfo reports all four bands of NAIP imagery as "Unknown" colorinterp. Sample image here: https://prd-tnm.s3.amazonaws.com/StagedProducts/NAIP/id_2015/46115/m_4611501_sw_11_1_20150702_20151207.jp2



This messes up apps like mapserver, which are then unable to serve out color images.



I attempted to add colorinterp information via an .aux.xml sidecar file. Gdalinfo reports that the sidecar file is detected and read, but the colorinterp is still unknown. Sidecar file contents below (what is shown is the entire file).



Googling around, I see reference to the openjpeg2000 driver using the sidecar file for georeferencing, but no mention of using it for colorinterp metadata. Can I fix the colorinterp using a sidecar file?



I know I can fix colorinterp by doing gdal_translate, but I have an awful lot of these files (~4TB), and any gdal_translation produces files 3x - 4x bigger. I want to avoid having the files get that big. I suspect the commercial encoders USDA is using are better than OpenJPEG2000, so I'd love to just leave the files alone and interpret the existing bands correctly. How would I do that?



<PAMDataset>
<PAMRasterBand band="1">
<ColorInterp>Red</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="2">
<ColorInterp>Green</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="3">
<ColorInterp>Blue</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="4">
<ColorInterp>Grey</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>






gdal jpeg-2000 naip






share|improve this question







New contributor




Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Mar 23 at 21:50









Bryce NordgrenBryce Nordgren

82




82




New contributor




Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Bryce Nordgren is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • I guess that the real problem is not with colorinterpretation but with the 4 band source data. Select the bands which you want to use for the RGB presentation with for example PROCESSING "BANDS=1,2,3".

    – user30184
    Mar 24 at 12:16











  • genius! can you make that an answer so I can accept it?

    – Bryce Nordgren
    2 days ago

















  • I guess that the real problem is not with colorinterpretation but with the 4 band source data. Select the bands which you want to use for the RGB presentation with for example PROCESSING "BANDS=1,2,3".

    – user30184
    Mar 24 at 12:16











  • genius! can you make that an answer so I can accept it?

    – Bryce Nordgren
    2 days ago
















I guess that the real problem is not with colorinterpretation but with the 4 band source data. Select the bands which you want to use for the RGB presentation with for example PROCESSING "BANDS=1,2,3".

– user30184
Mar 24 at 12:16





I guess that the real problem is not with colorinterpretation but with the 4 band source data. Select the bands which you want to use for the RGB presentation with for example PROCESSING "BANDS=1,2,3".

– user30184
Mar 24 at 12:16













genius! can you make that an answer so I can accept it?

– Bryce Nordgren
2 days ago





genius! can you make that an answer so I can accept it?

– Bryce Nordgren
2 days ago










1 Answer
1






active

oldest

votes


















0














MapServer can handle images with any number of bands but there are some limits in what can be rendered on screen. Images which have only 1 band or 1 data band and either an alpha band or a mask band are rendered by default as greyscale. Coloured presentation is possible through FORMATOPTION PALETTE https://mapserver.org/mapfile/outputformat.html.



Images which have 3 data bands and perhaps an extra alpha/mask band are rendered as RGB color image. Images which have 4 or more data bands get rendered as greyscale. For rendering multiband images as RGB user must select which bands to use with the PROCESSING "BANDS=[R],[G],[B]"directive https://mapserver.org/input/raster.html. Other processing directives, like PROCESSING "SCALE=" may be useful for improving the result.



For using 3 first bands of your image for rendering add this line into your LAYER:



PROCESSING "BANDS=1,2,3"





share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "79"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Bryce Nordgren is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316464%2fcorrecting-colorinterp-on-jpeg2000-naip-imagery-using-aux-xml%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    MapServer can handle images with any number of bands but there are some limits in what can be rendered on screen. Images which have only 1 band or 1 data band and either an alpha band or a mask band are rendered by default as greyscale. Coloured presentation is possible through FORMATOPTION PALETTE https://mapserver.org/mapfile/outputformat.html.



    Images which have 3 data bands and perhaps an extra alpha/mask band are rendered as RGB color image. Images which have 4 or more data bands get rendered as greyscale. For rendering multiband images as RGB user must select which bands to use with the PROCESSING "BANDS=[R],[G],[B]"directive https://mapserver.org/input/raster.html. Other processing directives, like PROCESSING "SCALE=" may be useful for improving the result.



    For using 3 first bands of your image for rendering add this line into your LAYER:



    PROCESSING "BANDS=1,2,3"





    share|improve this answer



























      0














      MapServer can handle images with any number of bands but there are some limits in what can be rendered on screen. Images which have only 1 band or 1 data band and either an alpha band or a mask band are rendered by default as greyscale. Coloured presentation is possible through FORMATOPTION PALETTE https://mapserver.org/mapfile/outputformat.html.



      Images which have 3 data bands and perhaps an extra alpha/mask band are rendered as RGB color image. Images which have 4 or more data bands get rendered as greyscale. For rendering multiband images as RGB user must select which bands to use with the PROCESSING "BANDS=[R],[G],[B]"directive https://mapserver.org/input/raster.html. Other processing directives, like PROCESSING "SCALE=" may be useful for improving the result.



      For using 3 first bands of your image for rendering add this line into your LAYER:



      PROCESSING "BANDS=1,2,3"





      share|improve this answer

























        0












        0








        0







        MapServer can handle images with any number of bands but there are some limits in what can be rendered on screen. Images which have only 1 band or 1 data band and either an alpha band or a mask band are rendered by default as greyscale. Coloured presentation is possible through FORMATOPTION PALETTE https://mapserver.org/mapfile/outputformat.html.



        Images which have 3 data bands and perhaps an extra alpha/mask band are rendered as RGB color image. Images which have 4 or more data bands get rendered as greyscale. For rendering multiband images as RGB user must select which bands to use with the PROCESSING "BANDS=[R],[G],[B]"directive https://mapserver.org/input/raster.html. Other processing directives, like PROCESSING "SCALE=" may be useful for improving the result.



        For using 3 first bands of your image for rendering add this line into your LAYER:



        PROCESSING "BANDS=1,2,3"





        share|improve this answer













        MapServer can handle images with any number of bands but there are some limits in what can be rendered on screen. Images which have only 1 band or 1 data band and either an alpha band or a mask band are rendered by default as greyscale. Coloured presentation is possible through FORMATOPTION PALETTE https://mapserver.org/mapfile/outputformat.html.



        Images which have 3 data bands and perhaps an extra alpha/mask band are rendered as RGB color image. Images which have 4 or more data bands get rendered as greyscale. For rendering multiband images as RGB user must select which bands to use with the PROCESSING "BANDS=[R],[G],[B]"directive https://mapserver.org/input/raster.html. Other processing directives, like PROCESSING "SCALE=" may be useful for improving the result.



        For using 3 first bands of your image for rendering add this line into your LAYER:



        PROCESSING "BANDS=1,2,3"






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 16 hours ago









        user30184user30184

        29.8k23057




        29.8k23057




















            Bryce Nordgren is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Bryce Nordgren is a new contributor. Be nice, and check out our Code of Conduct.












            Bryce Nordgren is a new contributor. Be nice, and check out our Code of Conduct.











            Bryce Nordgren is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid …


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316464%2fcorrecting-colorinterp-on-jpeg2000-naip-imagery-using-aux-xml%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Magento 1.9 observer on only new product added ( no updated product )Admin Create New Order ObserverObserver checkout_cart_product_add_after get product quantity in cartHow can I differentiate between product creation and saving existing products?How to get the original price Product SaveBeforeMagento Observer for Admin Sales order Address updateHow do i get quantity in a product_save_after event observer magento2?Using observer event to get updated customer infoSave product observer - detect availabilityEvent not triggered when new product added in admin : Magento 2magento 1.9 observer on quantity product change

            Does an object always see its latest internal state irrespective of thread? The 2019 Stack Overflow Developer Survey Results Are InDoes a finally block always get executed in Java?Java: serial thread confinement questionJava difference between fixed threadpool and scheduled threadpoolJackrabbit and concurrent modificationHow to stop a Runnable scheduled for repeated execution after a certain number of executionsMultiple threads accessing inner classHow can a loop be completed by two thread? say loop from count=1 to count=4 by ist thread and count =5 to 8 by 2nd thread?If I keep a reference to a Runnable, when does the Thread it ran on get released?How to stop a schedule ScheduledExecutorServiceHow to implement a singleThreadedScheduledExcecutor in wildfly

            Adding contour labels to SpatialLinesDataFrame or sf object? The Next CEO of Stack OverflowTearing of SpatialLinesDataFrame and problem with gClip functionAutomatically adjusting map labelsExtracting data.frame from simple features object in RR convert sf object back to SpatialPolygonsDataFrameSimplify polygons of sf objectlines of a SpatialLinesDataFrame corresponding to pointsCropping sf object in R?Pattern matching with grepl on SpatialPolygonsDataFrame object in RHow to create and empty SpatialLinesDataFrame in RWarning message in raster::rotate(): “this does not look like an appropriate object for this function”