Problem with reprojected images

Ed McNierney ed at TOPOZONE.COM
Tue Mar 14 15:32:59 EST 2006


Dirk -

No, that's not correct, because raster images are quantized into pixels.
Reprojection will create coordinates that need to be rounded to whole
integers to create pixel coordinates, and it is possible for such
calculations to cause adjacent pixels in the source coordinate system to
become one pixel apart in the output coordinate system.

Just think of a simple example of two horizontal lines, exactly one
pixel apart.

Let's suppose these lines run from (0,0) to (100,0), and from (0,1) to
(100,1) in the original projection coordinate system.  And let's suppose
you are viewing them at 1:1 scale so those coordinates are pixel
coordinates, too.  If those are two black lines on a white background,
you will see two adjacent horizontal lines with no gap at all between
them.

Now imagine that your new "projection" rotates the coordinate system
31.788 degrees counterclockwise and does nothing else.  The original
line from (0,0) to (100,0) now runs from (0,0) to (86,50), and the
second line runs from (0,1) to (88,51).  The output pixel coordinates
can't be fractional, so a bit of rounding (not rounding error, but
inevitable and correct rounding) now leaves a tiny gap between the
diagonal lines at the right-hand end.

The degree of separation and the pattern of the gap will depend a lot on
the exact view scales chosen and on "arbitrary" factors like the state
of the error term initialization in iterating across the source pixels.
There can be several different results that are all equally correct.

	- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242 

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Dirk Jesko
Sent: Tuesday, March 14, 2006 11:08 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Problem with reprojected images

Ed,

I already thought of something like this already. However, this should
not happen. If the images are seamless (our images are seamless and do
not have any borders) in the original projection, they should also be
seamless after a reprojection. Otherwise, I would call it a bug.

I just tested an older version of Mapserver (4.6.1). That one creates
seamless results, even if the images are reprojected. Only newer
versions (tested 4.8.1) produce non-seamless images. Can someone confirm
this?


Regards,
Dirk



Ed McNierney wrote:

>Dirk -
>
>I assume your tiled source images do not overlap, and that the 
>originals do not have white border strips around them.
>
>If that's the case, this may be an inevitable artifact of the 
>reprojection.  Look at the situation along one north/south edge between

>two tiles.
>
>If you render the tiles in the source projection you'll get two 
>adjacent vertical lines along the edges of each file, with no gap
between them.
>
>If you reproject the tiles, then you will have two adjacent edges that 
>are two diagonal lines.  The distance between the edges may not be 1, 
>and may vary by a pixel along the course of those two diagonal lines.
>When that happens, the images will sometimes overlap by one pixel (you 
>won't notice) and will sometimes leave a one-pixel gap (which is 
>obvious).  The obvious gaps will repeat in a regular pattern since the 
>phase difference between the two diagonal lines will be regular and 
>repeating.
>
>	- Ed
>
>Ed McNierney
>President and Chief Mapmaker
>TopoZone.com / Maps a la carte, Inc.
>73 Princeton Street, Suite 305
>North Chelmsford, MA  01863
>ed at topozone.com
>(978) 251-4242
>
>-----Original Message-----
>From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] 
>On Behalf Of Dirk Jesko
>Sent: Tuesday, March 14, 2006 3:04 AM
>To: MAPSERVER-USERS at LISTS.UMN.EDU
>Subject: [UMN_MAPSERVER-USERS] Problem with reprojected images
>
>Hi,
>
>I set up a WMS for aerial images. The images are projected in 
>Gauss-Krueger 3 and have a size of one square kilometer. The WMS also 
>provides other projections, e.g. Gauss-Krueger 2-5, UTM, etc. If I 
>query the WMS with a projection other than the original one, I get 
>little white lines along the edges of the tiles (see the attached 
>image). The image format does not matter. How do I get rid of these? I 
>can not find any option that might be related to this. By the way, this

>also happens if the data is accessed via mapscript or as normal cgi.
>
>Thanks for any help.
>
>Regards,
>Dirk
>
>  
>



More information about the mapserver-users mailing list