<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>Hi Arnd,</span></div><div><span><br></span></div><div><span>I see. I used the same 'mapserv' url in both OpenLayers.Layer.WMS and .MapServer code. The requests were sent to the same remote server. So the difference must be in the requests. Is it possible that OpenLayers.Layer.WMS generated a different output url string from the one generated by OpenLayers.Layer.MapServer?</span></div><div><br></div><div>Ken</div><div><br></div><div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Arnd Wippermann &lt;arnd.wippermann@web.de&gt;<br><b><span style="font-weight: bold;">To:</span></b> 'kensei3000' &lt;kensei3000@yahoo.com&gt;<br><b><span
 style="font-weight: bold;">Cc:</span></b> mapserver-users@lists.osgeo.org<br><b><span style="font-weight: bold;">Sent:</span></b> Thursday, June 30, 2011 1:15 AM<br><b><span style="font-weight: bold;">Subject:</span></b> AW: [mapserver-users] "Low-resolution" raster image problem when usingOpenlayers<br></font><br>
<div id="yiv1640254091">

 
 
 
<div dir="ltr" align="left">
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><span class="yiv1640254091765290517-29062011"><font face="Arial">Hi Ken,</font></span></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><span class="yiv1640254091765290517-29062011"><font face="Arial"></font></span></span>&nbsp;</div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><font face="Arial"><span class="yiv1640254091765290517-29062011">Quote : "</span>Interestingly, if I use the 'mapserv' 
executable directly in the browser instead of using OpenLayers API, the image 
also renders correctly.<span class="yiv1640254091765290517-29062011">"</span></font></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><font face="Arial"></font></span>&nbsp;</div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><span class="yiv1640254091765290517-29062011"><font face="Arial">There could be no difference 
(OpenLayers.Layer.WMS or .MapServer), because with OpenLayers you only create an 
url for an image tag (&lt;img src="url"&gt;). The response have to be the same 
as from the browser directly.</font></span></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><span class="yiv1640254091765290517-29062011"><font face="Arial"></font></span></span>&nbsp;</div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><span class="yiv1640254091765290517-29062011"><font face="Arial">The difference could only be a result 
from different requests or the same request to different 
servers.</font></span></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><span class="yiv1640254091765290517-29062011"><font face="Arial"></font></span></span>&nbsp;</div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><span class="yiv1640254091765290517-29062011"><font face="Arial">Arnd</font></span></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><span class="yiv1640254091765290517-29062011"></span></span>&nbsp;</div>
<div>
<hr tabindex="-1">
</div>
<div><font size="2" face="Tahoma"><b>Von:</b> kensei3000 
[mailto:kensei3000@yahoo.com] <br><b>Gesendet:</b> Mittwoch, 29. Juni 2011 
09:56<br><b>An:</b> Arnd Wippermann<br><b>Cc:</b> 
users@openlayers.org<br><b>Betreff:</b> Re: AW: [mapserver-users] 
"Low-resolution" raster image problem when 
usingOpenlayers<br></font><br></div></div>

<div style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-size: 10pt; font-family: arial, helvetica, sans-serif; ">
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span>Hi 
Arnd,</span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span><br></span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">I 
checked the images properties of the tile images using ImageMagick.<br></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span>tile_topleft_remote.png 
has image type "Palette" (8-bit)</span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span>tile_topleft_local.png 
has image type "TrueColor" (32-bit)</span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><br></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">The 
results I got seem to correlate with your findings.</div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">Indeed, 
it appears that the image rendering between my local pc and the server are 
different.</div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><br></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">The map 
files are exactly same since I sync them in both computers. &nbsp; 
&nbsp;&nbsp;<br></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><br></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">The 
MapServer versions, however, are different. Here's what I got:</div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><br></div>
<div>
<div><font class="yiv1640254091Apple-style-span" size="2">LOCAL:</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">MapServer version 6.0.0 OUTPUT=GIF 
OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO 
SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER 
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER 
SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">REMOTE:</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">MapServer version 5.6.1 OUTPUT=GIF 
OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ 
SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT 
SUPPORTS=WCS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">The MapServer executable in the remote 
server is an older version (5.6.1) than the one in my pc (6.0.0). I edited the 
map files and images in my local pc, then synced them to the server, so there 
may be an incompatibility. I checked the Mapserver Migration Guide 
(http://mapserver.org/de/MIGRATION_GUIDE.html) and my guess was that the default 
OUTPUTFORMAT specifications of both versions could be 
different.&nbsp;</font><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span">I 
did not specify an explicit OUTPUTFORMAT in my map file.</span></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">I created another test. This time I 
explicitly defined the OUTPUTFORMAT with the following lines added to the map 
file in the remote server:</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span">&nbsp;OUTPUTFORMAT</span><br></div>
<div><font class="yiv1640254091Apple-style-span" size="2">
<div>
<div>&nbsp; &nbsp; NAME jpeg</div>
<div>&nbsp; &nbsp; DRIVER "AGG/JPEG"</div>
<div>&nbsp; &nbsp; MIMETYPE "image/jpeg"</div>
<div>&nbsp; &nbsp; IMAGEMODE RGB</div>
<div>&nbsp; &nbsp; EXTENSION "jpg"</div>
<div>&nbsp; END</div></div>
<div><br></div></font><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span">The 
result was that the output image generated by the remote server rendered in 
TrueColor, similar to the output image in my local pc. Problem appears to be 
fixed.</span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><br></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span">My guess right now is 
that the &nbsp;IMAGEMODE parameter above was somehow set to PC256 (i.e. 8-bit 
color palette) by default.</span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><br></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span">Interestingly, if I 
use the 'mapserv' executable directly in the browser instead of using OpenLayers 
API, the image also renders correctly.</span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span">EXAMPLE:&nbsp;</span></div>
<div><font class="yiv1640254091Apple-style-span" size="2">http://remotehost/cgi-bin/mapserv?map=/opt/maps/sandbox/mapserver_openlayers_if/sample.map&amp;mode=map<br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">Above 'sample.map' did not have the 
OUTPUTFORMAT object explicitly defined.&nbsp;</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">In another test I ran using the 
original 'sample.map' (i.e. no OUTPUTFORMAT object), I edited the OpenLayers 
code in the remote server:</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">//sample.html</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">FROM:</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">&nbsp; &nbsp; 17<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;&nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp;layer = new OpenLayers.Layer.MapServer("World 
Map",&nbsp;<br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">TO:</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">
<div>&nbsp; &nbsp; 17<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> 
</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;layer = new 
OpenLayers.Layer.WMS("World Map",&nbsp;</div>
<div><br></div></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">I used the generic 'WMS' layer instead 
of the 'MapServer' layer. And the result was that the output image rendered 
correctly. I am not yet sure why.&nbsp;</font></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><br></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span">I might need to run 
additional tests to confirm my findings.</span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span"><br></span></div>
<div><span style="FONT-SIZE:13px;" class="yiv1640254091Apple-style-span">Thanks for your help 
in pointing out the discrepancies in the images and in MapServer. 
:)</span></div></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><br></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">Ken</div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">&nbsp;&nbsp;</div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><br></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">
<div style="font-size: 12pt; font-family: times, serif; "><font size="2" face="Arial">
<hr size="1">
<b><span style="FONT-WEIGHT:bold;">From:</span></b> Arnd Wippermann 
&lt;arnd.wippermann@web.de&gt;<br><b><span style="FONT-WEIGHT:bold;">To:</span></b> 'kensei3000' 
&lt;kensei3000@yahoo.com&gt;<br><b><span style="FONT-WEIGHT:bold;">Cc:</span></b> users@openlayers.org<br><b><span style="FONT-WEIGHT:bold;">Sent:</span></b> Wednesday, June 29, 2011 2:28 
AM<br><b><span style="FONT-WEIGHT:bold;">Subject:</span></b> AW: 
[mapserver-users] "Low-resolution" raster image problem when 
usingOpenlayers<br></font><br>
<div id="yiv1640254091">
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011">use some image viewer to get information 
of your images.</span></font></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011"></span></font></font></font>&nbsp;</div>
<div dir="ltr" align="left"><span class="yiv1640254091-28062011"></span><font face="Arial"><font color="#0000ff"><font size="2">tile_topleft_remote.png<span class="yiv1640254091-28062011"> is a 8bit image (256 color image), where 
only 45 colors used.</span></font></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011"></span></font></font></font>&nbsp;</div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011">tile_topleft_local.png is a 24bit image 
(16,7 Mill. colors), where 13274 colors used.</span></font></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011"></span></font></font></font>&nbsp;</div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011">The requests ask for map_imagetype=png. So 
it seems, that your mapfiles are different, because the response of the servers 
delivers a different&nbsp;image for the same imagetype. Or do you 
use&nbsp;different MapServer versions?</span></font></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011"></span></font></font></font>&nbsp;</div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011"></span></font></font></font><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011">The problem has to be an issue with 
MapServer and not with OpenLayers.</span></font></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011"></span></font></font></font>&nbsp;</div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011">Arnd</span></font></font></font></div>
<div dir="ltr" align="left"><font face="Arial"><font color="#0000ff"><font size="2"><span class="yiv1640254091-28062011"></span></font></font></font>&nbsp;</div>
<div dir="ltr" align="left">
<hr tabindex="-1">
</div>
<div dir="ltr" align="left"><font size="2" face="Tahoma"><b>Von:</b> kensei3000 
[mailto:kensei3000@yahoo.com] <br><b>Gesendet:</b> Dienstag, 28. Juni 2011 
04:32<br><b>An:</b> Arnd Wippermann<br><b>Cc:</b> 
users@openlayers.org<br><b>Betreff:</b> Re: AW: [mapserver-users] 
"Low-resolution" raster image problem when usingOpenlayers<br></font><br></div>
<div style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-size: 10pt; font-family: arial, helvetica, sans-serif; ">
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span>Hi 
Arnd,</span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span><br></span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span>Thanks 
a lot for the tip. I copied the image url of the top-left most tile for both 
local pc and remote server tests.</span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span>Here is 
what I got:</span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><span><br></span></div>
<div><span>
<div><font class="yiv1640254091Apple-style-span" size="2">Local:</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">http://localhost/cgi-bin/mapserv?map=%2Fopt%2Fmaps%2Fsandbox%2Fmapserver_openlayers_if%2Fsample.map&amp;layers=sample_raster&amp;mode=map&amp;map_imagetype=png&amp;mapext=-90+0+0+90&amp;imgext=-90+0+0+90&amp;map_size=256+256&amp;imgx=128&amp;imgy=128&amp;imgxy=256+256</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">Remote:</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">http://remotehost/cgi-bin/mapserv?map=%2Fopt%2Fmaps%2Fsandbox%2Fmapserver_openlayers_if%2Fsample.map&amp;layers=sample_raster&amp;mode=map&amp;map_imagetype=png&amp;mapext=-180+-90+0+90&amp;imgext=-180+-90+0+90&amp;map_size=256+256&amp;imgx=128&amp;imgy=128&amp;imgxy=256+256</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">The only significant 
difference of the two urls appear to be the 'mapext' and 'imgext' parameters. 
When I checked the resulting images after inputting the urls in the browser, I 
noticed that the tile images had different sizes and positions. I believe this 
was due to the said parameters. I tried changing the 'mapext' and 'imagext' 
parameters of the server test url to match that of the local test url, and 
indeed the size and position of the remote server tile image changed. However, I 
am still unable to figure out what causes the color distortion or "downsampling" 
of the image in the remote server.</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">For further reference, 
I've attached the tile images I got using the above urls.</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">Here is the openlayers 
code I used. It is the same for both local and remote server tests except for 
the host in line 18.&nbsp;</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">//sample.html</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">
<div>
<div>&nbsp; &nbsp; &nbsp;1<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&lt;html 
xmlns="http://www.w3.org/1999/xhtml"&gt;</div>
<div>&nbsp; &nbsp; &nbsp;2<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;&lt;head&gt;</div>
<div>&nbsp; &nbsp; &nbsp;3<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;&lt;style 
type="text/css"&gt;</div>
<div>&nbsp; &nbsp; &nbsp;4<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp;#map 
{</div>
<div>&nbsp; &nbsp; &nbsp;5<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp;width: 1024px;</div>
<div>&nbsp; &nbsp; &nbsp;6<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp;height: 768px;</div>
<div>&nbsp; &nbsp; &nbsp;7<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp;border: 1px solid black;</div>
<div>&nbsp; &nbsp; &nbsp;8<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp;}</div>
<div>&nbsp; &nbsp; &nbsp;9<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;&lt;/style&gt;</div>
<div>&nbsp; &nbsp; 10<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;&lt;script 
src="http://openlayers.org/dev/lib/OpenLayers.js"&gt;&lt;/script&gt;</div>
<div>&nbsp; &nbsp; 11<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;&lt;script 
type="text/javascript"&gt;</div>
<div>&nbsp; &nbsp; 12<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; 
&nbsp;&lt;!--</div>
<div>&nbsp; &nbsp; 13<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp;var map, 
layer;</div>
<div>&nbsp; &nbsp; 14<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 15<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp;function 
init(){</div>
<div>&nbsp; &nbsp; 16<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp;map = new OpenLayers.Map( 'map' );</div>
<div>&nbsp; &nbsp; 17<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp;layer = new OpenLayers.Layer.MapServer("World Map",&nbsp;</div>
<div>&nbsp; &nbsp; 18<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"http://localhost/cgi-bin/mapserv",</div>
<div>&nbsp; &nbsp; 19<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{map: 
'/opt/maps/sandbox/mapserver_openlayers_if/sample.map', layers: 
'sample_raster'});</div>
<div>&nbsp; &nbsp; 20<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp;map.addLayer(layer);</div>
<div>&nbsp; &nbsp; 21<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp;map.zoomToMaxExtent();</div>
<div>&nbsp; &nbsp; 22<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp;}</div>
<div>&nbsp; &nbsp; 23<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp; &nbsp;// 
--&gt;</div>
<div>&nbsp; &nbsp; 24<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;&lt;/script&gt;</div>
<div>&nbsp; &nbsp; 25<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;&lt;/head&gt;</div>
<div>&nbsp; &nbsp; 26<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;&lt;body 
onload="init()"&gt;</div>
<div>&nbsp; &nbsp; 27<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;&lt;div 
id="map"&gt;&lt;/div&gt;</div>
<div>&nbsp; &nbsp; 28<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;&lt;/body&gt;</div>
<div>&nbsp; &nbsp; 29<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&lt;/html&gt;</div>
<div><br></div></div>
<div><br></div></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">And below is the common 
.map file I created with the help of the Quantum GIS Mapserver Export 
tool.</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">The raster image has an 
associated World file (.wld) for georeferencing.</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">
<div>&nbsp; &nbsp; &nbsp;1<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span># Map file created from QGIS project 
file /var/maps/sandbox/mapserver_openlayers_if/sample.qgs</div>
<div>&nbsp; &nbsp; &nbsp;2<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span># Edit this file to customize for your 
map interface</div>
<div>&nbsp; &nbsp; &nbsp;3<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span># (Created with PyQgis MapServer 
Export plugin)</div>
<div>&nbsp; &nbsp; &nbsp;4<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>MAP</div>
<div>&nbsp; &nbsp; &nbsp;5<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;NAME "QGIS-MAP"</div>
<div>&nbsp; &nbsp; &nbsp;6<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;# Map image size</div>
<div>&nbsp; &nbsp; &nbsp;7<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;SIZE 8180 4930</div>
<div>&nbsp; &nbsp; &nbsp;8<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;UNITS meters</div>
<div>&nbsp; &nbsp; &nbsp;9<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 10<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;EXTENT -86.515507 -50.290979 
88.076495 48.225271</div>
<div>&nbsp; &nbsp; 11<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;PROJECTION</div>
<div>&nbsp; &nbsp; 12<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;'proj=longlat'</div>
<div>&nbsp; &nbsp; 13<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;'ellps=WGS84'</div>
<div>&nbsp; &nbsp; 14<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; 
&nbsp;'towgs84=0,0,0,0,0,0,0'</div>
<div>&nbsp; &nbsp; 15<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;'no_defs'</div>
<div>&nbsp; &nbsp; 16<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;END</div>
<div>&nbsp; &nbsp; 17<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 18<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;# Background color for the map 
canvas -- change as desired</div>
<div>&nbsp; &nbsp; 19<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;IMAGECOLOR 255 255 255</div>
<div>&nbsp; &nbsp; 20<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;IMAGEQUALITY 95</div>
<div>&nbsp; &nbsp; 21<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;IMAGETYPE jpeg</div>
<div>&nbsp; &nbsp; 22<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 23<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;# Legend</div>
<div>&nbsp; &nbsp; 24<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;LEGEND</div>
<div>&nbsp; &nbsp; 25<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp;IMAGECOLOR 255 255 
255</div>
<div>&nbsp; &nbsp; 26<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;STATUS ON</div>
<div>&nbsp; &nbsp; 27<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;KEYSIZE 18 12</div>
<div>&nbsp; &nbsp; 28<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;LABEL</div>
<div>&nbsp; &nbsp; 29<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp;TYPE BITMAP</div>
<div>&nbsp; &nbsp; 30<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp;SIZE MEDIUM</div>
<div>&nbsp; &nbsp; 31<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp; &nbsp;COLOR 0 0 89</div>
<div>&nbsp; &nbsp; 32<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;END</div>
<div>&nbsp; &nbsp; 33<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;END</div>
<div>&nbsp; &nbsp; 34<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 35<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;# Web interface definition. Only 
the template parameter</div>
<div>&nbsp; &nbsp; 36<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;# is required to display a map. 
See MapServer documentation</div>
<div>&nbsp; &nbsp; 37<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;WEB</div>
<div>&nbsp; &nbsp; 38<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;# Set IMAGEPATH to the 
path where MapServer should</div>
<div>&nbsp; &nbsp; 39<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;# write its output.</div>
<div>&nbsp; &nbsp; 40<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;IMAGEPATH '/tmp/'</div>
<div>&nbsp; &nbsp; 41<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 42<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;# Set IMAGEURL to the url 
that points to IMAGEPATH</div>
<div>&nbsp; &nbsp; 43<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;# as defined in your web 
server configuration</div>
<div>&nbsp; &nbsp; 44<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;IMAGEURL '/tmp/'</div>
<div>&nbsp; &nbsp; 45<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 46<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;#Scale range at which web 
interface will operate</div>
<div>&nbsp; &nbsp; 47<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;# Template and 
header/footer settings</div>
<div>&nbsp; &nbsp; 48<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;# Only the template 
parameter is required to display a map. See MapServer documentation</div>
<div>&nbsp; &nbsp; 49<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;TEMPLATE 
'fooOnlyForWMSGetFeatureInfo'</div>
<div>&nbsp; &nbsp; 50<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;END</div>
<div>&nbsp; &nbsp; 51<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 52<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;LAYER</div>
<div>&nbsp; &nbsp; 53<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;NAME 
'sample_raster'</div>
<div>&nbsp; &nbsp; 54<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;TYPE RASTER</div>
<div>&nbsp; &nbsp; 55<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;DUMP true</div>
<div>&nbsp; &nbsp; 56<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;TEMPLATE 
fooOnlyForWMSGetFeatureInfo</div>
<div>&nbsp; &nbsp; 57<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;EXTENT -86.515507 -50.290979 
88.076495 48.225271</div>
<div>&nbsp; &nbsp; 58<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;DATA 
'sec_field.jpg'</div>
<div>&nbsp; &nbsp; 59<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;STATUS DEFAULT</div>
<div>&nbsp; &nbsp; 60<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;TRANSPARENCY 100</div>
<div>&nbsp; &nbsp; 61<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;PROJECTION</div>
<div>&nbsp; &nbsp; 62<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;'proj=longlat'</div>
<div>&nbsp; &nbsp; 63<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;'ellps=WGS84'</div>
<div>&nbsp; &nbsp; 64<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; 
&nbsp;'towgs84=0,0,0,0,0,0,0'</div>
<div>&nbsp; &nbsp; 65<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;'no_defs'</div>
<div>&nbsp; &nbsp; 66<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp; &nbsp;END</div>
<div>&nbsp; &nbsp; 67<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>&nbsp;END</div>
<div>&nbsp; &nbsp; 68<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span></div>
<div>&nbsp; &nbsp; 69<span style="WHITE-SPACE:pre;" class="yiv1640254091Apple-tab-span"> </span>END</div>
<div><br></div>
<div><br></div></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">Hope you could provide 
further assistance.</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div>
<div><font class="yiv1640254091Apple-style-span" size="2">Ken</font></div>
<div><font class="yiv1640254091Apple-style-span" size="2"><br></font></div></span></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "><br></div>
<div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; ">
<div style="font-size: 12pt; font-family: times, serif; "><font size="2" face="Arial">
<hr size="1">
<b><span style="FONT-WEIGHT:bold;">From:</span></b> Arnd Wippermann 
&lt;arnd.wippermann@web.de&gt;<br><b><span style="FONT-WEIGHT:bold;">To:</span></b> 'kensei3000' 
&lt;kensei3000@yahoo.com&gt;<br><b><span style="FONT-WEIGHT:bold;">Cc:</span></b> users@openlayers.org<br><b><span style="FONT-WEIGHT:bold;">Sent:</span></b> Tuesday, June 28, 2011 1:53 
AM<br><b><span style="FONT-WEIGHT:bold;">Subject:</span></b> AW: 
[mapserver-users] "Low-resolution" raster image problem when 
usingOpenlayers<br></font><br>
<div id="yiv1640254091">
<div dir="ltr" align="left"><span class="yiv1640254091-27062011"><font color="#0000ff" size="2" face="Arial">hi,</font></span></div>
<div dir="ltr" align="left"><span class="yiv1640254091-27062011"><font color="#0000ff" size="2" face="Arial"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="yiv1640254091-27062011"><font color="#0000ff" size="2" face="Arial">if you do a right click on a tile to get the context menu, you 
should be able to copy the url (if the tiles of your server is the most top of 
the visible layers). Compare the different urls. If you load them in your 
browser you should get a response for a single tile from your 
server.</font></span></div>
<div dir="ltr" align="left"><span class="yiv1640254091-27062011"><font color="#0000ff" size="2" face="Arial"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="yiv1640254091-27062011"><font color="#0000ff" size="2" face="Arial">Perhaps that gives you an idea, what goes 
wrong.</font></span></div>
<div dir="ltr" align="left"><span class="yiv1640254091-27062011"><font color="#0000ff" size="2" face="Arial"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="yiv1640254091-27062011"><font color="#0000ff" size="2" face="Arial">Arnd</font></span></div><br>
<div dir="ltr" lang="de" class="yiv1640254091OutlookMessageHeader" align="left">
<hr tabindex="-1">
<font size="2" face="Tahoma"><b>Von:</b> mapserver-users-bounces@lists.osgeo.org 
[mailto:mapserver-users-bounces@lists.osgeo.org] <b>Im Auftrag von 
</b>kensei3000<br><b>Gesendet:</b> Montag, 27. Juni 2011 05:37<br><b>An:</b> 
mapserver-users@lists.osgeo.org<br><b>Betreff:</b> [mapserver-users] 
"Low-resolution" raster image problem when usingOpenlayers<br></font><br></div>
<div style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-size: 10pt; font-family: arial, helvetica, sans-serif; ">
<div>Hi!</div>
<div><br></div>
<div>I am trying to use MapServer as a WMS layer in Openlayers. I setup the 
MapServer in our server machine, using my own PC as the test client. I created a 
simple .map file in our server that contains one raster image. Using the 
mapserver tool 'mapserv' in a URL string, I was able to load the output map with 
full resolution correctly in a browser (Google Chrome). However, when I tried to 
load the map using a simple Openlayers script (HMTL) which I created on our 
server (accessible via browser), the map image appeared to have a much 
lower-resolution (i.e. 256-colors only) and was pixelized. Also, I could see 
white lines representing the tile edges of the map.&nbsp;</div>
<div><br></div>
<div>I did another test. This time, I installed MapServer in my own PC. I 
created a .map file similar to the one I used in our server, with the same 
raster image. I created a similar Openlayers script (HTML) in my own PC, but 
this time it would call the MapServer from my own PC. I loaded the script using 
a browser and the image displayed correctly with full resolution.&nbsp;</div>
<div><br></div>
<div>Does anyone have an idea what the problem could be?</div>
<div><br></div>
<div>I would appreciate any help in this matter.</div>
<div><br></div>
<div>Thanks in advance! :) 
&nbsp;</div></div></div><br><br></div></div></div></div><br><br></div></div></div> 
</div><br><br></div></div></div></body></html>