Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line pattern in image mosaic when reprojecting #1715

Closed
wants to merge 1 commit into from
Closed

Line pattern in image mosaic when reprojecting #1715

wants to merge 1 commit into from

Conversation

tbonfort
Copy link
Member

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
Copy link
Author

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

Problem reproduced. 

@mapserver-bot
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

attachment http://trac.osgeo.org/mapserver/attachment/ticket/1715/test.zip :

   test case for the bug

@ghost ghost assigned warmerdam Apr 5, 2012
@rouault
Copy link
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
Copy link
Contributor

rouault commented Jan 17, 2017

rouault@026847b merged in branch-7-0

@rouault rouault closed this Jan 17, 2017
@tbonfort tbonfort deleted the issues/1715-raster-cellsize branch January 19, 2017 09:20
rouault added a commit to rouault/mapserver that referenced this pull request Jun 14, 2017
… regressions like MapServer#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
msResampleGDALToMap(): restrict fix done for #1715, to avoid regressions like #5445
szekerest pushed a commit to DMS-Aus/MapServer that referenced this pull request Oct 8, 2017
… regressions like MapServer#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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants