<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=843370322-09092009><FONT face=Arial 
color=#0000ff size=2>Hi Paul,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843370322-09092009><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=843370322-09092009><FONT face=Arial 
color=#0000ff size=2>by default OpenLayers use EPSG:4326 for the map, if not 
otherwise declared. The extent for the whole world are -180,-90,180,90 with a 
resolution of 1.40. From your extent it seems, you want an other projection. So 
you have to declare the projection in the map options.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843370322-09092009></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=843370322-09092009><FONT face=Arial 
color=#0000ff size=2>Arnd</FONT>&nbsp;</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843370322-09092009><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><FONT face=Tahoma size=2><B>Von:</B> 
users-bounces@openlayers.org [mailto:users-bounces@openlayers.org] <B>Im Auftrag 
von </B>Paul Curran<BR><B>Gesendet:</B> Mittwoch, 9. September 2009 
22:20<BR><B>An:</B> Alexandre Dube<BR><B>Cc:</B> 
users@openlayers.org<BR><B>Betreff:</B> Re: [OpenLayers-Users] Call Mapfile 
layer with Openlayers whenstatus ON or OFF<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Thanks for your responses</DIV>
<DIV>&nbsp;</DIV>
<DIV>I have now removed the map parameter as&nbsp;suggested. I am just trying to 
display one layer correctly and&nbsp;i will then add my second layer when my 
single layer&nbsp;looks right. </DIV>
<DIV>&nbsp;</DIV>
<DIV>My layer&nbsp;is now displaying tiled across the screen several times and 
quite zoomed out, i cannot zoom in or out</DIV>
<DIV>&nbsp;</DIV>
<DIV>My code now looks as follows:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var bounds = new OpenLayers.Bounds(0, 0, 
660046, 1229782);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var map, layer1, 
layer2;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var options = { maxExtent: bounds, 
maxResolution: 600, numZoomLevels: 10};</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function 
init(){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map = new 
OpenLayers.Map('map', options);</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layer1 = new 
OpenLayers.Layer.WMS("OpenLayers WMS",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "<A 
href="http://localhost/cgi-bin/mapserv.exe?mode=map&amp;map=c:/ms4w/apps/openlayers-2.5/data/uk2.map">http://localhost/cgi-bin/mapserv.exe?mode=map&amp;map=c:/ms4w/apps/openlayers-2.5/data/uk2.map</A>", 
{ layers: "250" },<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { gutter: 15, minZoomLevel: 
1, maxZoomLevel: 4 });</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
map.addLayer(layer1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
map.zoomToExtent(bounds);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
map.setCenter(bounds);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
map.zoomToMaxExtent();</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addControl(new 
OpenLayers.Control.PanZoomBar());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
map.addControl(new 
OpenLayers.Control.MousePosition());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;</DIV>
<DIV>Any more much much appreciatted</DIV>
<DIV>&nbsp;</DIV>
<DIV>Cheers<BR><BR></DIV>
<DIV class=gmail_quote>2009/9/9 Alexandre Dube <SPAN dir=ltr>&lt;<A 
href="mailto:adube@mapgears.com">adube@mapgears.com</A>&gt;</SPAN><BR>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi 
  Paul,<BR><BR>You can copy the image url by right clicking on it and open it in 
  a new window. You'll see the request url constructed by OpenLayers and maybe 
  an error message from MapServer.<BR><BR>I noticed that you use the "map" 
  parameter. WMS has no such parameter so it should be part of your main url, 
  like below. Also, if you look in the OpenLayers/Layer/WMS.js code, you'll see 
  that this object takes 4 parameters, the 3e being the server-side "parameters" 
  and the 4th being the OpenLayers object "options". min/maxZoomLevel are not 
  parameters but OL options. 
  <DIV class=im><BR><BR>layer1 = new OpenLayers.Layer.WMS(<BR>"OpenLayers 
  WMS",<BR><BR></DIV>"<A 
  href="http://127.0.0.1/cgi-bin/mapserv.exe?map=/ms4w/apps/openlayers-2.5/data/uk2.map&amp;" 
  target=_blank>http://127.0.0.1/cgi-bin/mapserv.exe?map=/ms4w/apps/openlayers-2.5/data/uk2.map&amp;</A>",<BR>{ 
  layers: "uk"},<BR><BR>{ gutter: 15, minZoomLevel: 1, maxZoomLevel: 4 
  }<BR>);<BR><BR><BR>If you still get pink tiles, copy the link in a new window 
  to see the error.<BR><BR>Regards,<BR><BR>Alexandre<BR><BR>Paul Curran 
  wrote:<BR>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
    <DIV>
    <DIV></DIV>
    <DIV class=h5><BR>Hi<BR><BR>I can view my UK Layer via Mapserver with the 
    following url: 
    'ms4w/cgi-bin/mapserv.exe?mode=map&amp;map=c:mapdirectory*&amp;layer=uk'.* 
    The *&amp;layer=uk *is calling my layer.<BR><BR>However I can’t find any 
    documentation on how to call the layer when viewing my map within 
    OpenLayers.<BR><BR>I am currently trying to call the layer like 
    this:<BR><BR>var map, layer1, layer2;<BR><BR>var options = { maxExtent: 
    bounds, maxResolution: 600, numZoomLevels: 10};<BR><BR>layer1 = new 
    OpenLayers.Layer.WMS("OpenLayers WMS",<BR><BR>"<A 
    href="http://127.0.0.1/cgi-bin/mapserv.exe" 
    target=_blank>http://127.0.0.1/cgi-bin/mapserv.exe</A>?", { layers: "uk", 
    map: '/ms4w/apps/openlayers-2.5/data/uk2.map',<BR><BR>minZoomLevel: 1, 
    maxZoomLevel: 4 },<BR><BR>{ gutter: 15 });<BR><BR>layer2 = new 
    OpenLayers.Layer.WMS("OpenLayers WMS",<BR><BR>"<A 
    href="http://127.0.0.1/cgi-bin/mapserv.exe" 
    target=_blank>http://127.0.0.1/cgi-bin/mapserv.exe</A>?", { layers: "250", 
    map: '/ms4w/apps/openlayers-2.5/data/uk2.map',<BR><BR>minZoomLevel: 5, 
    maxZoomLevel: 10},<BR><BR>{ gutter: 15 });<BR><BR>map.addLayer(uk, 
    250);<BR><BR>map.zoomToExtent(bounds);<BR><BR>map.setCenter(bounds);<BR><BR>map.zoomToMaxExtent();<BR><BR>However 
    I am just seeing pink tiles within OpenLayers.<BR><BR>Note: If my layers are 
    set to default within my Mapfile all my layers are displayed.<BR><BR>Thanks 
    for any help in 
    advance<BR><BR>Paul<BR><BR></DIV></DIV>------------------------------------------------------------------------<BR><BR>_______________________________________________<BR>Users 
    mailing list<BR><A href="mailto:Users@openlayers.org" 
    target=_blank>Users@openlayers.org</A><BR><A 
    href="http://openlayers.org/mailman/listinfo/users" 
    target=_blank>http://openlayers.org/mailman/listinfo/users</A><BR>&nbsp;<BR></BLOCKQUOTE><BR><BR>-- 
  <BR>Alexandre Dubé<BR>Mapgears<BR><A href="http://www.mapgears.com/" 
  target=_blank>www.mapgears.com</A><BR><BR></BLOCKQUOTE></DIV><BR></BODY></HTML>