Opened 7 years ago

Last modified 7 years ago

#4210 new defect

GeoTiff images with overviews, black borders towards NODATA areas

Reported by: armin Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL Support Version: 6.0
Severity: normal Keywords: gdaladdo, overviews, average resampling
Cc:

Description

When using Geotiff files with overviews created with "gdaladdo -r average ..."

the NODATA values cannot completely be removed in MapServer with the setting

OFFSITE 0 0 0

Along the border DATA-NODATA a ~1-pixel line remains black. This happens for data where the DATA-NODATA border is not an exact horizontal or vertical line but where the images have NODATA triangles at the image borders due to image warping during reprojection.

The attached small screenshot files show this effect:

At lower zoom levels, where the overviews are read instead of the full resolution image, the images have black pixels along the border of the DATA areas (file names are *_using_ov*). This effect disappears when the full resolution image is read at high zoom levels (file names *_no_ov*). This effect happens both for PNG and JPEG images retrieved via WMS requests (outputformats are the MS defaults for both types).

layer definition in the map file is

LAYER
  NAME "test_ov_avg_chip"
  TYPE Raster
  DATA "/home/test/chip.tif"
  DUMP TRUE
  METADATA
    "ows_title"  "TEST OV-AVG"
  END
  OFFSITE 0 0 0
  PROJECTION
    "init=epsg:3035"
  END
END

Test was done with MapServer 6.0.1 and layers used via WMS, everything running on Linux.

An analysis of the images and their overviews showed correct creation of the overviews with gdal. All overviews extracted with dumpoverviews had 0 data values for NODATA in each band along the border to DATA areas, so no "averaging" seems to have been applied to them. The problem looks for me more related in the way MapServer reads and handles the image data. The effect however does not appear if the overviews are created with nearest resampling.

In addition, special effects with strangely colored pixels appear (chip_wms_02_no_ov_bilinear.png) along the NODATA border when the layer processing with resampling is activated via map file tag

PROCESSING "RESAMPLE=BILINEAR"

This is independent of reading overviews or the full resolution image.

A small test image chip is included as well.

Attachments (6)

chip_wms_02_using_ov.png (117.3 KB) - added by armin 7 years ago.
chip_wms_01_using_ov.png (66.4 KB) - added by armin 7 years ago.
chip_wms_02_no_ov.png (216.5 KB) - added by armin 7 years ago.
chip_wms_01_no_ov.png (188.5 KB) - added by armin 7 years ago.
chip_wms_02_no_ov_bilinear.png (54.0 KB) - added by armin 7 years ago.
chip_wms_01_using_ov_format-jpeg.png (71.2 KB) - added by armin 7 years ago.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by armin

Attachment: chip_wms_02_using_ov.png added

Changed 7 years ago by armin

Attachment: chip_wms_01_using_ov.png added

Changed 7 years ago by armin

Attachment: chip_wms_02_no_ov.png added

Changed 7 years ago by armin

Attachment: chip_wms_01_no_ov.png added

Changed 7 years ago by armin

Changed 7 years ago by armin

comment:1 Changed 7 years ago by armin

the zip file with the test image could not be uploaded due to size restrictions (has 3 MB)

Note: See TracTickets for help on using tickets.