<p class="MsoNormal">Hello!</p>
<p class="MsoNormal">I’ve just started to learn about OpenLayers, MapServer etc.</p>
<p class="MsoNormal">And I have a question. When I add a Map file as Mapserver
layer it works fine, but when I add it as WMS layer it just displays a
background color (that I have defined in my .map file) and some small
unreadable letters. </p>
<p class="MsoNormal">Probably you would be so kind to help me to find a mistake
in my map file or in html?</p>
<p class="MsoNormal">Thanks and sorry for asking such a beginner question.</p>
<p class="MsoNormal">Here is my mapfile:</p>
<p class="MsoNormal">MAP</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>NAME 'World Map'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># Map image size</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>STATUS ON</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>SIZE 600 300</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>EXTENT -180.0 -90.0
180.0 90.0</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>UNITS dd</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>SHAPEPATH
'C://GIS/Data/puvWorld'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>IMAGECOLOR 255 255
255</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>PROJECTION</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'proj=longlat'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'ellps=WGS84'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'datum=WGS84'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'no_defs'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># Background color
for the map canvas -- change as desired</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>IMAGECOLOR 255 0 0</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>IMAGEQUALITY 95</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>IMAGETYPE png24</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>OUTPUTFORMAT</p>
<p class="MsoNormal"><span style="mso-tab-count:1"> </span>NAME
png</p>
<p class="MsoNormal"><span style="mso-tab-count:1"> </span>DRIVER
"GD/PNG"</p>
<p class="MsoNormal"><span style="mso-tab-count:1"> </span>MIMETYPE
"image/png"</p>
<p class="MsoNormal"><span style="mso-tab-count:1"> </span>IMAGEMODE
PC256</p>
<p class="MsoNormal"><span style="mso-tab-count:1"> </span>EXTENSION
"png"</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># Legend</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>LEGEND</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>IMAGECOLOR 255
255 255</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>STATUS ON</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>KEYSIZE 18 12</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>LABEL</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>TYPE BITMAP</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>SIZE MEDIUM</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>COLOR 0 0 89</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># Web interface
definition. Only the template parameter</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># is required to
display a map. See MapServer documentation</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>WEB</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># Set IMAGEPATH to
the path where MapServer should</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># write its
output.</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>IMAGEPATH '/tmp/'</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># Set IMAGEURL to
the url that points to IMAGEPATH</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># as defined in
your web server configuration</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>IMAGEURL '/tmp/'</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># WMS server
settings</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>METADATA</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'wms_title'<span style="mso-spacerun:yes"> </span>'World Map'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes">
</span>'wms_onlineresource'<span style="mso-spacerun:yes">
</span>'<a href="http://localhost/cgi-bin/mapserv.exe?map=wms.map&">http://localhost/cgi-bin/mapserv.exe?map=wms.map&</a>'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'wms_srs'<span style="mso-spacerun:yes"> </span>'EPSG:4326'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>#Scale range at
which web interface will operate</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># Template and
header/footer settings</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span># Only the
template parameter is required to display a map. See MapServer documentation</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>LAYER</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>NAME
'world_raster'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>TYPE RASTER</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>DATA
world_raster.tif</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>METADATA</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'wms_title'
'world_raster'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>#'queryable'
'true'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>#'wms_srs'<span style="mso-spacerun:yes"> </span>'EPSG:4326'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>STATUS DEFAULT</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>TRANSPARENCY 100</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>PROJECTION</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'proj=longlat'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'ellps=WGS84'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'datum=WGS84'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'no_defs'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>LAYER</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>NAME 'world_adm0'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>TYPE POLYGON</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>DATA world_adm0</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>METADATA</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'wms_title'
'world_adm0'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>#'queryable'
'true'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>#'wms_srs'<span style="mso-spacerun:yes"> </span>'EPSG:4326'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>STATUS DEFAULT</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>TRANSPARENCY 100</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>PROJECTION</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'proj=longlat'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'ellps=WGS84'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'datum=WGS84'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>'no_defs'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>CLASS</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>NAME
'world_adm0'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>STYLE</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>SYMBOL 0 </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>SIZE 6 </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>OUTLINECOLOR
0 0 0</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>END</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">END</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">And here is my html code:</p>
<p class="MsoNormal"><html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><head></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><style
type="text/css"></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>#map {</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><span style="mso-spacerun:yes"> </span>width: 600px;</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>height:
300px;</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>border:
1px solid black;</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>}</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span></style></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><script
src="/openlayers/OpenLayers.js"></script></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><script
type="text/javascript"></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><!--</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>var map,
layer;</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>function
init(){</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>map = new
OpenLayers.Map( 'map' );</p>
<p class="MsoNormal"><span style="mso-tab-count:3"> </span>layer
= new OpenLayers.Layer.WMS( "World Map",</p>
<p class="MsoNormal"><span style="mso-spacerun:yes">
</span>"<a href="http://127.0.0.1/cgi-bin/mapserv.exe?map=C:/GIS/Projects/puvWorld.map">http://127.0.0.1/cgi-bin/mapserv.exe?map=C:/GIS/Projects/puvWorld.map</a>"</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>/*{</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><span style="mso-spacerun:yes"> </span>layers:
'world_raster', 'world_adm0',</p>
<p class="MsoNormal"><span style="mso-tab-count:1"> </span><span style="mso-spacerun:yes"> </span>srs:
'EPSG:4326'</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>}*/<span style="mso-spacerun:yes"> </span></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>);</p>
<p class="MsoNormal"><span style="mso-tab-count:3"> </span>/*layer
= new OpenLayers.Layer.MapServer( "World Map", </p>
<p class="MsoNormal"><span style="mso-spacerun:yes">
</span>"<a href="http://localhost/cgi-bin/mapserv.exe">http://localhost/cgi-bin/mapserv.exe</a>", {map:
'C:/GIS/Projects/puvWorld.map'} );*/</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>/*layer =
new OpenLayers.Layer.MapServer( "OpenLayers WMS", </p>
<p class="MsoNormal"><span style="mso-spacerun:yes">
</span>"<a href="http://labs.metacarta.com/wms/vmap0">http://labs.metacarta.com/wms/vmap0</a>", {layers: 'basic'} );*/</p>
<p class="MsoNormal"><span style="mso-spacerun:yes">
</span>map.addLayer(layer);</p>
<p class="MsoNormal"><span style="mso-spacerun:yes">
</span>map.zoomToMaxExtent();</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>}</p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span>// --></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span></script></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span></head></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><body
onLoad="init()"></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span><div
id="map"></div></p>
<p class="MsoNormal"><span style="mso-spacerun:yes"> </span></body></p>
<p class="MsoNormal"></html></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thank you very much in advance. </p>
<p class="MsoNormal">Zmicjer Koľuch<span style="mso-ansi-language:CS" lang="CS"></span></p>