Opened 12 years ago
Closed 9 years ago
#4462 closed defect (fixed)
gdalwarp drops the ColorInterp parameter from each band
Reported by: | tomtaylor | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | 1.9.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
gdalwarp 1.9.0 seems to not pass the ColorInterp values through when warping a VRT file into a new VRT file. For example, given a VRT file built using gdalbuildvrt, with the following info reported in gdalinfo:
Size is 655000, 1220000 Coordinate System is `' Origin = (5000.000000000000000,1225000.000000000000000) Pixel Size = (1.000000000000000,-1.000000000000000) Corner Coordinates: Upper Left ( 5000.000, 1225000.000) Lower Left ( 5000.000, 5000.000) Upper Right ( 660000.000, 1225000.000) Lower Right ( 660000.000, 5000.000) Center ( 332500.000, 615000.000) Band 1 Block=128x128 Type=Byte, ColorInterp=Red Band 2 Block=128x128 Type=Byte, ColorInterp=Green Band 3 Block=128x128 Type=Byte, ColorInterp=Blue
Running this command:
gdalwarp -of vrt -s_srs EPSG:27700 -t_srs EPSG:3785 -r cubic -multi 10k.vrt 10k-merc.vrt
Returns a VRT file with the following info reported in gdalinfo:
Origin = (-1378178.776500732172281,8865652.585775766521692) Pixel Size = (1.770868355216086,-1.770868355216086) Corner Coordinates: Upper Left (-1378178.777, 8865652.586) ( 12d22'49.41"W, 61d52' 3.79"N) Lower Left (-1378178.777, 6414264.314) ( 12d22'49.41"W, 49d37'29.94"N) Upper Right ( 309650.020, 8865652.586) ( 2d46'53.88"E, 61d52' 3.79"N) Lower Right ( 309650.020, 6414264.314) ( 2d46'53.88"E, 49d37'29.94"N) Center ( -534264.378, 7639958.450) ( 4d47'57.76"W, 56d13'47.46"N) Band 1 Block=512x128 Type=Byte, ColorInterp=Undefined Band 2 Block=512x128 Type=Byte, ColorInterp=Undefined Band 3 Block=512x128 Type=Byte, ColorInterp=Undefined
Note the Undefined ColorInterp parameter on each band. If I manually edit the file to include this parameter back in for each band, the new VRT file behaves properly.
Change History (2)
comment:1 by , 12 years ago
comment:2 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
gdalwarp has also a -setci switch
Partially fixed :
r23792 /trunk/gdal/apps/gdalwarp.cpp: gdalwarp: assign color interpretation of source bands to target dataset, in the case of target VRT (#4462)
r23793 /branches/1.9/gdal/apps/gdalwarp.cpp: gdalwarp: assign color interpretation of source bands to target dataset, in the case of target VRT (#4462)
For other target drivers, it might cause spurious .aux.xml files to be produced because they don't handle setting color interpreation and then fallback to PAM, so for now it was restricted to VRT where it works fine.