Problem with reprojected images

Rahkonen Jukka Jukka.Rahkonen at MMMTIKE.FI
Tue Mar 14 10:32:19 EST 2006


Hi,
 
I think it is exactly as Ed says.  I got similar kind of problems once when I started to reproject images with "gdal_translate", and mosaic and cut the reprojected images to suit mapsheet system of the destination projection.
 
With gdal_translate I can get rid of those white (in my case black) pixel lines by using a GDAL virtual format (.vrt)as a source data set instead of individual files. I have been thinking that this means in practise building a mosaic before reprojection, thus there is no place in the process where those lines would be formed. Judged by the result you get I guess that maybe the tileindex system in Mapserver is handling each tile separately and not in the same way than GDAL is handling VRT. If getting rid of those lines is important for you it might be worth trying to use GDAL virtual data set as source data for your Mapserver instead of tileindex. There has been a link to a modified "gdal_merge.py" script in the gdal_dev mailing list possible in May 2005, but I could not find the link right now. With that script you can make a virtual data set from a bunch of original image files, and after creating pyramid layers for the vrt-file (this will be slow if your VRT is large) it is quite usable for Mapserver.
 
Regards,
 
Jukka Rahkonen
 
<http://xserve.flids.com/pipermail/gdal-dev/2005-May/008605.html>  

________________________________

Lähettäjä: UMN MapServer Users List puolesta: Ed McNierney
Lähetetty: ti 14.3.2006 16:38
Vastaanottaja: MAPSERVER-USERS at LISTS.UMN.EDU
Aihe: Re: [UMN_MAPSERVER-USERS] Problem with reprojected images



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

Here a part of the mapfile:

MAP
 ...
 IMAGECOLOR      255 255 255
 EXTENT          3100000 5200000 4100000 6200000
 SIZE            500 500
 SHAPEPATH       "/data/daten/WMS"

 PROJECTION
   "init=epsg:31467"     # GK 3
 END

 WEB
   METADATA
     ...
     "wms_srs" "EPSG:31467 EPSG:31466 EPSG:31468 EPSG:31469 EPSG:32632
EPSG:32633 EPSG:4326"
     "wms_encoding" "UTF-8"
     "wms_feature_info_mime_type" "application/vnd.ogc.gml"
   END

   MAXSCALE   10000000
   MINSCALE   1000

   ...
 END

 OUTPUTFORMAT
   NAME png24
   DRIVER "GD/PNG"
   MIMETYPE "image/png"
   IMAGEMODE RGB
   EXTENSION "png"
   FORMATOPTION "INTERLACE=ON"
 END
 OUTPUTFORMAT
   NAME png
   DRIVER "GD/PNG"
   MIMETYPE "image/png"
   IMAGEMODE PC256
   EXTENSION "png"
   FORMATOPTION "INTERLACE=ON"
 END
 OUTPUTFORMAT
   NAME jpeg
   DRIVER "GD/JPEG"
   MIMETYPE "image/jpeg"
   IMAGEMODE RGB
   EXTENSION "jpg"
   FORMATOPTION "QUALITY=95"
   FORMATOPTION "PROGRESSIVE=ON"
 END

 ...

 LAYER
   NAME         "img02000"
   GROUP        "img"
   TILEINDEX    "IMG_02000.shp"
   TILEITEM     "locationUn"
   TYPE         RASTER
   MAXSCALE     500000.0
   MINSCALE     100000.0
   PROJECTION
     "init=epsg:31467"     # GK 3
   END
   METADATA
      ...
   END
 END

 ...

END



More information about the mapserver-users mailing list