[Qgis-user] [EXTERNAL] Re: Working with second band of two-band GeoTIFF

Alex M tech_dev at wildintellect.com
Mon Jun 24 09:25:17 PDT 2019


Eric,

That is indeed strange behavior. I can not replicate on QGIS 3.4 +
Linux, hopefully another Mac user can jump in to test. At first I
thought maybe the lack of band stats but that doesn't seem to be an
issue. For me I can see it in the Raster Calculator without issue.

As a workaround, I found in the toolbox "Rearrange Bands" which will let
you save out specific bands (it's gdal_translate with the -b option).

+1 for feature request that selecting bands should be on the Save As
dialog for rasters.

Also take a look at the Information tab and see if it differs from
gdalinfo, just to verify QGIS is reading the file correctly.

Thanks,
Alex

On 6/24/19 09:04, Fielding, Eric J (329A) wrote:
> Alex,
> 
> Here is the output of gdalinfo on the file:
> ======
> gdalinfo filt_topophase.unw.geo.tif
> Driver: GTiff/GeoTIFF
> Files: filt_topophase.unw.geo.tif
> Size is 4866, 6076
> Coordinate System is:
> GEOGCS["WGS 84",
>     DATUM["WGS_1984",
>         SPHEROID["WGS 84",6378137,298.257223563,
>             AUTHORITY["EPSG","7030"]],
>         AUTHORITY["EPSG","6326"]],
>     PRIMEM["Greenwich",0],
>     UNIT["degree",0.0174532925199433],
>     AUTHORITY["EPSG","4326"]]
> Origin = (104.507222222222225,28.770277777777778)
> Pixel Size = (0.000277777777778,-0.000277777777778)
> Metadata:
>   AREA_OR_POINT=Area
> Image Structure Metadata:
>   INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  ( 104.5072222,  28.7702778) (104d30'26.00"E, 28d46'13.00"N)
> Lower Left  ( 104.5072222,  27.0825000) (104d30'26.00"E, 27d 4'57.00"N)
> Upper Right ( 105.8588889,  28.7702778) (105d51'32.00"E, 28d46'13.00"N)
> Lower Right ( 105.8588889,  27.0825000) (105d51'32.00"E, 27d 4'57.00"N)
> Center      ( 105.1830556,  27.9263889) (105d10'59.00"E, 27d55'35.00"N)
> Band 1 Block=512x512 Type=Float32, ColorInterp=Gray
>   NoData Value=0
>   Overviews: 2433x3038, 1217x1519, 609x760, 305x380, 153x190
> Band 2 Block=512x512 Type=Float32, ColorInterp=Undefined
>   NoData Value=0
>   Overviews: 2433x3038, 1217x1519, 609x760, 305x380, 153x190
> ===========
> 
> I can see that band two has ColorInterp=Undefined. I don't know what that means.
> 
> The GeoTIFF file is automatically generated by some SAR interferometry processing scripts we have and it is over 300 MB. The direct link to the file is:
> http://hysds-urgent-response.s3-us-west-2.amazonaws.com/datasets/interferogram/v1.2/2019/06/09/S1-IFG_RM_M1S2_TN055_20190621T110015-20190609T105947_s1-resorb-1ea6-v1.2-china/merged/filt_topophase.unw.geo.tif
> 
> Thanks,
> 	++Eric
> 
> -----Original Message-----
> From: Alex M <tech_dev at wildintellect.com>
> 
>     On 6/23/19 11:11, Fielding, Eric J (329A) wrote:
>     > I only recently switched to QGIS 3, so I am not sure whether I am missing something that was moved to a different place or the handling of raster layers changed. I am using 3.6.0 on a Mac. I have a two-band GeoTIFF image, and I want to run the Raster Calculator on the second band of the image. When I open the Raster Calculator, it only shows me band 1 of the image (image_name at 1). I tried forcing it to use band 2 with @2, but that did not work. I looked at layer Export->Save As and I don’t see a way to save the second band there. I finally went to the terminal and used “gdal_translate -b 2” to save the second band to a separate file. In QGIS 2, it showed me the two bands of the image in the Raster Calculator. Is there a way to do this inside QGIS 3?
>     > 
>     
>     Eric,
>     
>     Can you provide a sample 2 band raster file?
>     Also what does the Information tab in the layer Properties show (should
>     be similar to gdalinfo)?
>     
>     I'm wondering if it thinks your 2nd band is an Alpha/Mask layer and
>     treats it differently.
>     
>     Thanks,
>     Alex
>     
> 



More information about the Qgis-user mailing list