Opened 18 years ago

Closed 14 years ago

#1715 closed defect (worksforme)

Line pattern in image mosaic when reprojecting

Reported by: ml.dje@… Owned by: warmerdam
Priority: high Milestone:
Component: MapServer CGI Version: 4.8
Severity: normal Keywords:
Cc:

Description (last modified by warmerdam)

Creating a mosaic from seamless tiled images creates a regular pattern of lines
in the background color along the edges of the images. This only happens if the
image is requested in a projection other than the source projection.

Further:
1. only versions 4.8.x of mapserver are affected (4.6.1 works fine)
2. the pattern is only visible at certain combinations of image resolution, map
extent and map size.

Regarding 1: The gdal version is different (1.2 vs. 1.3). Maybe this is somehow
related.
Regarding 2: It seems that the effect preferably occurs if the images are scaled
down.

Attachments (1)

test.zip (104.6 KB ) - added by ml.dje@… 18 years ago.
test case for the bug

Download all attachments as: .zip

Change History (7)

by ml.dje@…, 18 years ago

Attachment: test.zip added

test case for the bug

comment:1 by fwarmerdam, 18 years ago

Status: newassigned
Problem reproduced. 

comment:2 by fwarmerdam, 18 years ago

I have established that this problem was introduced with the fix for 
Bug 1493 related to excessive oversampling of data for reprojection. 
Rolling back mapresample.c to Rev 1.61 undoes the problem. 

... digging further to see what ought to be done. 

comment:3 by fwarmerdam, 18 years ago

Resolution: fixed
Status: assignedclosed
OK, I have determined that the problem relates to the calculation:

    nLoadImgXSize = (int) MAX(1,(sSrcExtent.maxx - sSrcExtent.minx) 
                              * (dfNominalCellSize / sDummyMap.cellsize));
    nLoadImgYSize = (int) MAX(1,(sSrcExtent.maxy - sSrcExtent.miny) 
                              * (dfNominalCellSize / sDummyMap.cellsize));

There is round off implicit in this, which can result in the dummy map 
not having quite the full extents of the original source raster.  The fix
is to recompute a cellsize to ensure it relates to the full source image 
extents. 

    sDummyMap.cellsize = 
        ((sSrcExtent.maxx - sSrcExtent.minx) * dfNominalCellSize) / nLoadImgXSize;

This fixes things in the demonstration example.  I think this problem
could also occur in MapServer 4.6, but it was much less common due to 
the oversampling mentioned in bug 1493. 

I will apply this fix in 4.9 and 4.8-branch, so it should appear in 
mapserver 4.8.2. 


comment:4 by ml.dje@…, 18 years ago

I finally managed to upgrade to mapserver 4.8.3 and tested the fix for this bug.
Generally the line patterns appear less frequent. For example, the test case I
submitted works fine now. However, in some situations there are still patterns
visible. If it is of any help, I would prepare a new test case. Thanks for any help.

comment:5 by fwarmerdam, 18 years ago

Resolution: fixed
Status: closedreopened
Dirk,

If you prepare another test case I'll take a look.  It may be that there isn't
much I can do practically to deal with it, but I'd like to verify that I 
understand what is going on. 

comment:6 by warmerdam, 14 years ago

Description: modified (diff)
Resolution: worksforme
Status: reopenedclosed

No new test case was offered, so I'm closing this as works for me. I'll look into it if a demonstration is offered.

Note: See TracTickets for help on using tickets.