Line pattern in image mosaic when reprojecting #1715

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
@tbonfort
Member

tbonfort commented Jun 28, 2016

Reporter: ml.dje@geocontent.de
Date: 2006/03/15 - 12:58
Trac URL: http://trac.osgeo.org/mapserver/ticket/1715

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.
@mapserver-bot

This comment has been minimized.

Show comment
Hide comment
@mapserver-bot

mapserver-bot Apr 3, 2012

Author: fwarmerdam
Date: 2006/03/15 - 20:19

Problem reproduced. 

Author: fwarmerdam
Date: 2006/03/15 - 20:19

Problem reproduced. 

@mapserver-bot

This comment has been minimized.

Show comment
Hide comment
@mapserver-bot

mapserver-bot Apr 3, 2012

Author: fwarmerdam
Date: 2006/03/15 - 20:28

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. 

Author: fwarmerdam
Date: 2006/03/15 - 20:28

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. 

@mapserver-bot

This comment has been minimized.

Show comment
Hide comment
@mapserver-bot

mapserver-bot Apr 3, 2012

Author: fwarmerdam
Date: 2006/03/15 - 21:41

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. 


Author: fwarmerdam
Date: 2006/03/15 - 21:41

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. 


@mapserver-bot

This comment has been minimized.

Show comment
Hide comment
@mapserver-bot

mapserver-bot Apr 3, 2012

Author: ml.dje@geocontent.de
Date: 2006/05/29 - 10:41

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.

Author: ml.dje@geocontent.de
Date: 2006/05/29 - 10:41

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.
@mapserver-bot

This comment has been minimized.

Show comment
Hide comment
@mapserver-bot

mapserver-bot Apr 3, 2012

Author: fwarmerdam
Date: 2006/05/29 - 16:35

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. 

Author: fwarmerdam
Date: 2006/05/29 - 16:35

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. 

@mapserver-bot

This comment has been minimized.

Show comment
Hide comment
@mapserver-bot

mapserver-bot Apr 3, 2012

Author: warmerdam
Date: 2010/03/29 - 16:18
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.

Author: warmerdam
Date: 2010/03/29 - 16:18
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.

@mapserver-bot

This comment has been minimized.

Show comment
Hide comment

@ghost ghost assigned warmerdam Apr 5, 2012

@tbonfort tbonfort reopened this Jun 28, 2016

@tbonfort tbonfort referenced this pull request in mapserver/mapcache Jul 8, 2016

Closed

Tiles reprojection and white lines (holes) between tiles #146

@ltclm ltclm referenced this pull request in geoadmin/mf-geoadmin3 Oct 8, 2016

Closed

Pixelkarte grau quality issue at zoom 7 #3509

tbonfort referenced this pull request in rouault/mapserver Jan 17, 2017

@rouault

This comment has been minimized.

Show comment
Hide comment
@rouault

rouault Jan 17, 2017

Contributor

@tbonfort How did you reproduce the issue ? I tried with https://trac.osgeo.org/mapserver/raw-attachment/ticket/1715/test.zip and
"shp2img -m test_31468_large.map -o out_31438_large.png" and "shp2img -m test_31468.map -o out_31438.png" and I can't see any line artifact in the mosaic (with or without your patch, and the results are binarily identical in both cases)

Contributor

rouault commented Jan 17, 2017

@tbonfort How did you reproduce the issue ? I tried with https://trac.osgeo.org/mapserver/raw-attachment/ticket/1715/test.zip and
"shp2img -m test_31468_large.map -o out_31438_large.png" and "shp2img -m test_31468.map -o out_31438.png" and I can't see any line artifact in the mosaic (with or without your patch, and the results are binarily identical in both cases)

rouault added a commit to rouault/mapserver that referenced this pull request Jan 17, 2017

rouault added a commit to rouault/mapserver that referenced this pull request Jan 17, 2017

rouault added a commit to rouault/mapserver that referenced this pull request Jan 17, 2017

rouault added a commit to rouault/mapserver that referenced this pull request Jan 17, 2017

@rouault

This comment has been minimized.

Show comment
Hide comment
@rouault

rouault Jan 17, 2017

Contributor

rouault@026847b merged in branch-7-0

Contributor

rouault commented Jan 17, 2017

rouault@026847b merged in branch-7-0

@rouault rouault closed this Jan 17, 2017

@tbonfort tbonfort deleted the tbonfort:issues/1715-raster-cellsize branch Jan 19, 2017

rouault added a commit to rouault/mapserver that referenced this pull request Jun 14, 2017

msResampleGDALToMap(): restrict fix done for #1715, to avoid regressi…
…ons like #5445


mapserver@026847b
introduced a post correction of the source geotransform so that it matches the
sSrcExtent exactly. However the condition for this to make sense is that the
initial geotransform has square pixels.

rouault added a commit that referenced this pull request Jun 14, 2017

Merge pull request #5447 from rouault/fix_5445
msResampleGDALToMap(): restrict fix done for #1715, to avoid regressions like #5445

szekerest added a commit to DMS-Aus/MapServer that referenced this pull request Oct 8, 2017

msResampleGDALToMap(): restrict fix done for #1715, to avoid regressi…
…ons like #5445


mapserver@026847b
introduced a post correction of the source geotransform so that it matches the
sSrcExtent exactly. However the condition for this to make sense is that the
initial geotransform has square pixels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment