<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=337410218-08102008><FONT face=Arial color=#0000ff size=2>If the 
layer status is not set to default, you can add it to the URL call e.g. 
&amp;layer=countries</FONT></SPAN></DIV>
<DIV><SPAN class=337410218-08102008><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=337410218-08102008><FONT face=Arial color=#0000ff size=2>If you 
want the legend to refresh every time a user pans or zooms, you will want to 
have code that watches for the moveend event and updates the legend div.&nbsp; 
Turns out, the example post that you cited may not be the best way to do it, but 
I am quite familiar with it...</FONT></SPAN></DIV>
<DIV><SPAN class=337410218-08102008><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=337410218-08102008><FONT face=Arial color=#0000ff 
size=2>David.</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
  mapserver-users-bounces@lists.osgeo.org 
  [mailto:mapserver-users-bounces@lists.osgeo.org] <B>On Behalf Of </B>Roger 
  André<BR><B>Sent:</B> Wednesday, October 08, 2008 12:58 PM<BR><B>To:</B> Subha 
  Ramakrishnan<BR><B>Cc:</B> mapserver-users@lists.osgeo.org<BR><B>Subject:</B> 
  Re: [mapserver-users] Creating legend<BR><BR></FONT></DIV>
  <DIV dir=ltr>Hi Subha,<BR><BR>I think for the "mode=legend" to work, you need 
  to change the LAYER status to DEFAULT.&nbsp; However, you can test the legend 
  function via WMS request without changing the status by using a request 
  similar to this: (linebreaks added for clarity)<BR><BR><A 
  href="http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/states/states.map">http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/states/states.map</A><BR>&amp;service=wms<BR>&amp;version=%221.1.1%22<BR>&amp;request=GetLegendGraphic<BR>&amp;layer=countries<BR>&amp;styles=<BR>&amp;width=60<BR>&amp;height=40<BR>&amp;format=png<BR><BR>Roger<BR>--<BR><BR>
  <DIV class=gmail_quote>On Tue, Oct 7, 2008 at 11:38 PM, Subha Ramakrishnan 
  <SPAN dir=ltr>&lt;<A 
  href="mailto:subha@gslab.com">subha@gslab.com</A>&gt;</SPAN> wrote:<BR>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Fawcett, 
    David wrote:<BR>
    <BLOCKQUOTE class=gmail_quote 
    style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Or, 
      just a straight mode=legend request to the CGI if you are using MapServer. 
      &nbsp;You can pass in your extent, that will manage the scale-dependent 
      layers.<BR><BR></BLOCKQUOTE>Will the map file remain the same for this? I 
    did try using mode=legend in my request and added that to a separate DIV.But 
    the request doesn't seem to be generating any image.<BR>This is how my map 
    file looks. I've not pasted the entire contents as its too 
    big.<BR><BR>legend<BR>&nbsp; status on<BR>&nbsp; imagecolor 255 0 
    0<BR>&nbsp; position ul<BR>&nbsp;end<BR>&nbsp;layer<BR>&nbsp; CONNECTIONTYPE 
    postgis<BR>&nbsp; name india_states<BR>&nbsp; CONNECTION "user=postgres 
    dbname=ibp host=localhost"<BR>&nbsp; group world<BR>&nbsp; type 
    polygon<BR>&nbsp; dump true<BR>&nbsp; METADATA<BR>&nbsp; &nbsp; 
    &nbsp;"wfs_title" "Factbook Metadata"<BR>&nbsp; &nbsp; 
    &nbsp;"gml_include_items" "all"<BR>&nbsp; &nbsp; 
    &nbsp;"wms_feature_info_mime_type" "text/html"<BR>&nbsp; END<BR>&nbsp; 
    template "template.html"<BR>&nbsp; projection<BR>&nbsp; &nbsp; 
    "init=epsg:4326"<BR>&nbsp; end<BR>&nbsp; transparency alpha<BR>&nbsp; status 
    on<BR>&nbsp; data "topology from india_states using unique id using SRID = 
    -1"<BR>&nbsp; &nbsp; &nbsp; CLASSITEM "state"<BR>&nbsp; &nbsp; &nbsp; 
    CLASS<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NAME "JAMMU &amp; 
    KASHMIR"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EXPRESSION 
    "JAMMU &amp; KASHMIR"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    STYLE<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; COLOR 191 191 155<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OUTLINECOLOR 000 000 000<BR>&nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #antialias 
    true<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<BR>&nbsp; 
    &nbsp; &nbsp; end<BR>&nbsp; &nbsp; CLASS<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; NAME "HIMACHAL"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; EXPRESSION "HIMACHAL"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; STYLE<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; &nbsp; COLOR 245 226 188<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OUTLINECOLOR 000 000 
    000<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; #antialias true<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    end<BR>&nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    <BR>And this request is like this as per the example i found here :<A 
    href="http://openlayers.org/pipermail/users/2008-September/007495.html" 
    target=_blank>http://openlayers.org/pipermail/users/2008-September/007495.html</A><BR>var 
    legenddiv = 
    document.createElement('div');<BR>legenddiv.setAttribute('id','legend');<BR>legenddiv.innerHTML 
    = '&lt;img src = "<A 
    href="http://localhost/cgi-bin/mapserv?mode=legend&amp;map=%27+mapfile+" 
    target=_blank>http://localhost/cgi-bin/mapserv?mode=legend&amp;map='+mapfile+</A>'"&lt;/img&gt;';<BR>document.getElementById('map').appendChild(legenddiv);<BR><BR>Thanks 
    &amp; regards,<BR>Subha<BR>&nbsp; &nbsp; &nbsp; &nbsp;<BR>
    <BLOCKQUOTE class=gmail_quote 
    style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">David.<BR><BR>&nbsp; 
      &nbsp;-----Original Message-----<BR>&nbsp; &nbsp;*From:* <A 
      href="mailto:mapserver-users-bounces@lists.osgeo.org" 
      target=_blank>mapserver-users-bounces@lists.osgeo.org</A><BR>&nbsp; 
      &nbsp;[mailto:<A href="mailto:mapserver-users-bounces@lists.osgeo.org" 
      target=_blank>mapserver-users-bounces@lists.osgeo.org</A>] *On Behalf 
      Of<BR>&nbsp; &nbsp;*Roger André<BR>&nbsp; &nbsp;*Sent:* Tuesday, October 
      07, 2008 12:06 PM<BR>&nbsp; &nbsp;*To:* Steve Lime<BR>&nbsp; &nbsp;*Cc:* 
      <A href="mailto:mapserver-users@lists.osgeo.org" 
      target=_blank>mapserver-users@lists.osgeo.org</A><BR>&nbsp; 
      &nbsp;*Subject:* Re: [mapserver-users] Creating legend<BR><BR>&nbsp; 
      &nbsp;Also, you might want to consider making a separate<BR>&nbsp; 
      &nbsp;GetLegendGraphic WMS request and putting the legend in a 
      separate<BR>&nbsp; &nbsp;DIV element in your web page. <BR>&nbsp; 
      &nbsp;Just an idea.<BR>&nbsp; &nbsp;--<BR><BR>&nbsp; &nbsp;On Tue, Oct 7, 
      2008 at 8:22 AM, Steve Lime<BR>&nbsp; &nbsp;&lt;<A 
      href="mailto:Steve.Lime@dnr.state.mn.us" 
      target=_blank>Steve.Lime@dnr.state.mn.us</A> &lt;mailto:<A 
      href="mailto:Steve.Lime@dnr.state.mn.us" 
      target=_blank>Steve.Lime@dnr.state.mn.us</A>&gt;&gt;<BR>&nbsp; 
      &nbsp;wrote:<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;Visit:<BR><BR>&nbsp; &nbsp; 
      &nbsp; &nbsp; <A 
      href="http://www.openlayers.org/dev/examples/example-list.html" 
      target=_blank>http://www.openlayers.org/dev/examples/example-list.html</A><BR><BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;and search for untiled. There's a "WMS Untiled" 
      example you<BR>&nbsp; &nbsp; &nbsp; &nbsp;can view the source of. The 
      singleTile option goes in the<BR>&nbsp; &nbsp; &nbsp; &nbsp;"options" 
      object as opposed the "params" object. Params get<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;passed to the WMS service, options are handled by OL.<BR><BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;Steve<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt;&gt; 
      Subha Ramakrishnan &lt;<A href="mailto:subha@gslab.com" 
      target=_blank>subha@gslab.com</A><BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&lt;mailto:<A href="mailto:subha@gslab.com" 
      target=_blank>subha@gslab.com</A>&gt;&gt; 10/07/08 9:58 AM 
      &gt;&gt;&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;Hi Steve,<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;It would be great if you can give me an example or tell 
      me<BR>&nbsp; &nbsp; &nbsp; &nbsp;where it is<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;usually set in OL.<BR>&nbsp; &nbsp; &nbsp; &nbsp;Thanks for your 
      help.<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;Subha<BR><BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;Steve Lime wrote:<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; There's nothing 
      you have to do on the MapServer side. Looks<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;like your OL config is wrong<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; 
      though. I think 'singleTile' is set in the wrong<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;configuration object, perhaps others are in<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&gt; the wrong place too.<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; Steve<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt;&gt;&gt;&gt; Subha Ramakrishnan &lt;<A 
      href="mailto:subha@gslab.com" target=_blank>subha@gslab.com</A><BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;&lt;mailto:<A href="mailto:subha@gslab.com" 
      target=_blank>subha@gslab.com</A>&gt;&gt; 10/07/08 1:30 AM 
      &gt;&gt;&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt;&gt;&gt;<BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;&gt; Hi,<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;&gt; I am using mapserver 5.0.2 with 
      openlayers.<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; I've a problem while 
      creating a legend for a map from<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;mapserver.When i<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; try to overlay 
      the image from the mapserver on openlayers'<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;base map, the<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; images are rendered 
      in tiles, and every tile has a legend<BR>&nbsp; &nbsp; &nbsp; &nbsp;and is 
      limited<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; by the size of the tile. So, i 
      see lots of legends on the<BR>&nbsp; &nbsp; &nbsp; &nbsp;map and 
      only<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; half of them are visible as it is 
      restricted by the tile size.<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;&gt; This is my request to mapserver from 
      openlayers<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&gt; var mapfile = layer_tablename+'.map';<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&gt; twms1 = new OpenLayers.Layer.WMS(<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&gt; layer_tablename,"<A href="http://localhost/cgi-bin/mapserv" 
      target=_blank>http://localhost/cgi-bin/mapserv</A>?",<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt; { map: mapfile,<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; 
      &nbsp; &nbsp;transparent: 'true', layers:layer_tablename,<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt; &nbsp; &nbsp;format: 'image/png',<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt; &nbsp; 
      &nbsp;projection:"EPSG:4326",reproject:false,<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&gt; &nbsp; &nbsp;units: "m",<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; 
      &nbsp; &nbsp;singleTile: true<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; 
      },{numZoomLevels : MaxZoomLevel});<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; 
      map.addLayer(twms1);<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt; I am using the option of singleTile. Is there any 
      setting to<BR>&nbsp; &nbsp; &nbsp; &nbsp;be done in<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt; the map file or mapserver for it render a single 
      tile/single<BR>&nbsp; &nbsp; &nbsp; &nbsp;legend per<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt; image?<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;&gt; Thank you.<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; Regards,<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt; Subha<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;&gt; 
      _______________________________________________<BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&gt; mapserver-users mailing list<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt; 
      <A href="mailto:mapserver-users@lists.osgeo.org" 
      target=_blank>mapserver-users@lists.osgeo.org</A><BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&lt;mailto:<A href="mailto:mapserver-users@lists.osgeo.org" 
      target=_blank>mapserver-users@lists.osgeo.org</A>&gt;<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;&gt; <A 
      href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" 
      target=_blank>http://lists.osgeo.org/mailman/listinfo/mapserver-users</A><BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp;&gt;<BR>&nbsp; 
      &nbsp; &nbsp; &nbsp;&gt;<BR><BR><BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;_______________________________________________<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;mapserver-users mailing list<BR>&nbsp; &nbsp; &nbsp; &nbsp;<A 
      href="mailto:mapserver-users@lists.osgeo.org" 
      target=_blank>mapserver-users@lists.osgeo.org</A><BR>&nbsp; &nbsp; &nbsp; 
      &nbsp;&lt;mailto:<A href="mailto:mapserver-users@lists.osgeo.org" 
      target=_blank>mapserver-users@lists.osgeo.org</A>&gt;<BR>&nbsp; &nbsp; 
      &nbsp; &nbsp;<A 
      href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" 
      target=_blank>http://lists.osgeo.org/mailman/listinfo/mapserver-users</A><BR><BR><BR><BR>-- 
      <BR>This message has been scanned for viruses and<BR>dangerous content by 
      *MailScanner* &lt;<A href="http://www.mailscanner.info/" 
      target=_blank>http://www.mailscanner.info/</A>&gt;, and is<BR>believed to 
      be 
      clean.<BR>------------------------------------------------------------------------<BR><BR>_______________________________________________<BR>mapserver-users 
      mailing list<BR><A href="mailto:mapserver-users@lists.osgeo.org" 
      target=_blank>mapserver-users@lists.osgeo.org</A><BR><A 
      href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" 
      target=_blank>http://lists.osgeo.org/mailman/listinfo/mapserver-users</A><BR>&nbsp;<BR></BLOCKQUOTE><BR></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>