[gdal-dev] A couple of new issues with gdal

Even Rouault even.rouault at spatialys.com
Fri Apr 14 11:06:59 PDT 2017


On vendredi 14 avril 2017 13:39:12 CEST Stephen Woodbridge wrote:
> Hi Even,
> 
> GDAL 2.1.0, released 2016/04/25
> 
> I'm pretty happy with the new workflow so far, but have te following
> minor issues.
> 
> The color interp is still problematic with gdalinfo, even though the
> *.aux.xml file looks correct, except it is missing the Alpha band. I
> generated the final tif using a VRT that defined the the color interp.
> 
> The second issue is that I'm getting a lot of:
>     Warning 1: JPEGLib:Premature end of JPEG file
> messages when I run gdaladdo

Can you provide a fully reproducable (ie all input files and scripts) procedure so that others 
can try easily ? Ideally with smallish files, etc

> 
> When I try to display it with imagemagick it complains that it is
> PhotometricInterpretation=4, (ie: a Transparency Mask) which seems to
> make sense since I asked for a mask.
> 
> -Steve
> 
> I've reduced my processing to the following steps:
> 
> 1. create a sobel image from the source tif with the same georeferencing
> 2. gdalwarp it to EPSG:4326 in tempfile2
> 
> 3. gdalwarp source tif to EPSG:4326 in tempfile1
> gdalwarp -t_srs EPSG:4326 -dstalpha -co TILED=YES \
> src/33118/m_3311814_nw_11_1_20140513.tif \
> tmp/116-1-m_3311814_nw_11_1_20140513.tif
> 
> 4. generate a vrt with
>          # a band = [filename, src_band_no, color_interp]
>          bands = [ [tempfile1, 1, 'Red'],
>                    [tempfile1, 2, 'Green'],
>                    [tempfile1, 3, 'Blue'],
>                    [tempfile1, 4, 'Gray'],   # IR band
>                    [tempfile2, 1, 'Gray'],   # Sobel band to add
>                    [tempfile1, 5, 'Alpha'] ] # Alpha band
> 
> and each VRTRasterBand looks like:
> '''
>            <VRTRasterBand dataType="{0}" band="{1:d}">
>              <ColorInterp>{2}</ColorInterp>
>              <SimpleSource>
>              <SourceFilename relativeToVRT="1">{3}</SourceFilename>
>              <SourceBand>{4:d}</SourceBand>
>              <SrcRect xOff="0" yOff="0" xSize="{5:d}" ySize="{6:d}"/>
>              <DstRect xOff="0" yOff="0" xSize="{5:d}" ySize="{6:d}"/>
>              </SimpleSource>
>            </VRTRasterBand>'''
> 
> 5. translate vrt to tiff and compress it
> gdal_translate -co TILED=YES -co JPEG_QUALITY=90 -co COMPRESS=JPEG -co
> INTERLEAVE=BAND -mask 6 --config GDAL_TIFF_INTERNAL_MASK YES \
> tmp/116-2-m_3311814_nw_11_1_20140513.vrt \
> dest/m_3311814_nw_11_1_20140513.tif
> 
> $ gdalinfo dest/m_3311814_nw_11_1_20140513.tif
> Driver: GTiff/GeoTIFF
> Files: dest/m_3311805_ne_11_1_20140513.tif
>         dest/m_3311805_ne_11_1_20140513.tif.aux.xml
> Size is 7232, 7056
> 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 = (-118.441851318576212,34.003461706049677)
> Pixel Size = (0.000009839810447,-0.000009839810447)
> Metadata:
>    AREA_OR_POINT=Area
> Image Structure Metadata:
>    COMPRESSION=JPEG
>    INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  (-118.4418513,  34.0034617) (118d26'30.66"W, 34d 0'12.46"N)
> Lower Left  (-118.4418513,  33.9340320) (118d26'30.66"W, 33d56' 2.52"N)
> Upper Right (-118.3706898,  34.0034617) (118d22'14.48"W, 34d 0'12.46"N)
> Lower Right (-118.3706898,  33.9340320) (118d22'14.48"W, 33d56' 2.52"N)
> Center      (-118.4062706,  33.9687469) (118d24'22.57"W, 33d58' 7.49"N)
> Band 1 Block=256x256 Type=Byte, ColorInterp=Gray
>    Overviews: 3616x3528, 1808x1764, 904x882, 452x441, 226x221, 113x111,
> 57x56
>    Mask Flags: PER_DATASET
>    Overviews of mask band: 3616x3528, 1808x1764, 904x882, 452x441,
> 226x221, 113x111, 57x56
> Band 2 Block=256x256 Type=Byte, ColorInterp=Undefined
>    Overviews: 3616x3528, 1808x1764, 904x882, 452x441, 226x221, 113x111,
> 57x56
>    Mask Flags: PER_DATASET
>    Overviews of mask band: 3616x3528, 1808x1764, 904x882, 452x441,
> 226x221, 113x111, 57x56
> Band 3 Block=256x256 Type=Byte, ColorInterp=Undefined
>    Overviews: 3616x3528, 1808x1764, 904x882, 452x441, 226x221, 113x111,
> 57x56
>    Mask Flags: PER_DATASET
>    Overviews of mask band: 3616x3528, 1808x1764, 904x882, 452x441,
> 226x221, 113x111, 57x56
> Band 4 Block=256x256 Type=Byte, ColorInterp=Undefined
>    Overviews: 3616x3528, 1808x1764, 904x882, 452x441, 226x221, 113x111,
> 57x56
>    Mask Flags: PER_DATASET
>    Overviews of mask band: 3616x3528, 1808x1764, 904x882, 452x441,
> 226x221, 113x111, 57x56
> Band 5 Block=256x256 Type=Byte, ColorInterp=Undefined
>    Overviews: 3616x3528, 1808x1764, 904x882, 452x441, 226x221, 113x111,
> 57x56
>    Mask Flags: PER_DATASET
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170414/469b2fea/attachment-0001.html>


More information about the gdal-dev mailing list