<!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.
&layer=countries</FONT></SPAN></DIV>
<DIV><SPAN class=337410218-08102008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </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.
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> </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. 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>&service=wms<BR>&version=%221.1.1%22<BR>&request=GetLegendGraphic<BR>&layer=countries<BR>&styles=<BR>&width=60<BR>&height=40<BR>&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><<A
href="mailto:subha@gslab.com">subha@gslab.com</A>></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.
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> status on<BR> imagecolor 255 0
0<BR> position ul<BR> end<BR> layer<BR> CONNECTIONTYPE
postgis<BR> name india_states<BR> CONNECTION "user=postgres
dbname=ibp host=localhost"<BR> group world<BR> type
polygon<BR> dump true<BR> METADATA<BR>
"wfs_title" "Factbook Metadata"<BR>
"gml_include_items" "all"<BR>
"wms_feature_info_mime_type" "text/html"<BR> END<BR>
template "template.html"<BR> projection<BR>
"init=epsg:4326"<BR> end<BR> transparency alpha<BR> status
on<BR> data "topology from india_states using unique id using SRID =
-1"<BR> CLASSITEM "state"<BR>
CLASS<BR> NAME "JAMMU &
KASHMIR"<BR> EXPRESSION
"JAMMU & KASHMIR"<BR>
STYLE<BR>
COLOR 191 191 155<BR>
OUTLINECOLOR 000 000 000<BR>
#antialias
true<BR> end<BR>
end<BR> CLASS<BR>
NAME "HIMACHAL"<BR>
EXPRESSION "HIMACHAL"<BR>
STYLE<BR>
COLOR 245 226 188<BR>
OUTLINECOLOR 000 000
000<BR>
#antialias true<BR>
end<BR> end
<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
= '<img src = "<A
href="http://localhost/cgi-bin/mapserv?mode=legend&map=%27+mapfile+"
target=_blank>http://localhost/cgi-bin/mapserv?mode=legend&map='+mapfile+</A>'"</img>';<BR>document.getElementById('map').appendChild(legenddiv);<BR><BR>Thanks
& regards,<BR>Subha<BR> <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>
-----Original Message-----<BR> *From:* <A
href="mailto:mapserver-users-bounces@lists.osgeo.org"
target=_blank>mapserver-users-bounces@lists.osgeo.org</A><BR>
[mailto:<A href="mailto:mapserver-users-bounces@lists.osgeo.org"
target=_blank>mapserver-users-bounces@lists.osgeo.org</A>] *On Behalf
Of<BR> *Roger André<BR> *Sent:* Tuesday, October
07, 2008 12:06 PM<BR> *To:* Steve Lime<BR> *Cc:*
<A href="mailto:mapserver-users@lists.osgeo.org"
target=_blank>mapserver-users@lists.osgeo.org</A><BR>
*Subject:* Re: [mapserver-users] Creating legend<BR><BR>
Also, you might want to consider making a separate<BR>
GetLegendGraphic WMS request and putting the legend in a
separate<BR> DIV element in your web page. <BR>
Just an idea.<BR> --<BR><BR> On Tue, Oct 7,
2008 at 8:22 AM, Steve Lime<BR> <<A
href="mailto:Steve.Lime@dnr.state.mn.us"
target=_blank>Steve.Lime@dnr.state.mn.us</A> <mailto:<A
href="mailto:Steve.Lime@dnr.state.mn.us"
target=_blank>Steve.Lime@dnr.state.mn.us</A>>><BR>
wrote:<BR><BR> Visit:<BR><BR>
<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>
and search for untiled. There's a "WMS Untiled"
example you<BR> can view the source of. The
singleTile option goes in the<BR> "options"
object as opposed the "params" object. Params get<BR>
passed to the WMS service, options are handled by OL.<BR><BR>
Steve<BR><BR> >>>
Subha Ramakrishnan <<A href="mailto:subha@gslab.com"
target=_blank>subha@gslab.com</A><BR>
<mailto:<A href="mailto:subha@gslab.com"
target=_blank>subha@gslab.com</A>>> 10/07/08 9:58 AM
>>><BR> Hi Steve,<BR>
It would be great if you can give me an example or tell
me<BR> where it is<BR>
usually set in OL.<BR> Thanks for your
help.<BR><BR> Subha<BR><BR>
Steve Lime wrote:<BR> > There's nothing
you have to do on the MapServer side. Looks<BR>
like your OL config is wrong<BR> >
though. I think 'singleTile' is set in the wrong<BR>
configuration object, perhaps others are in<BR>
> the wrong place too.<BR>
><BR> > Steve<BR>
><BR> ><BR>
>>>> Subha Ramakrishnan <<A
href="mailto:subha@gslab.com" target=_blank>subha@gslab.com</A><BR>
<mailto:<A href="mailto:subha@gslab.com"
target=_blank>subha@gslab.com</A>>> 10/07/08 1:30 AM
>>><BR> >>>><BR>
> Hi,<BR> ><BR>
> I am using mapserver 5.0.2 with
openlayers.<BR> > I've a problem while
creating a legend for a map from<BR>
mapserver.When i<BR> > try to overlay
the image from the mapserver on openlayers'<BR>
base map, the<BR> > images are rendered
in tiles, and every tile has a legend<BR> and is
limited<BR> > by the size of the tile. So, i
see lots of legends on the<BR> map and
only<BR> > half of them are visible as it is
restricted by the tile size.<BR> ><BR>
> This is my request to mapserver from
openlayers<BR> ><BR>
> var mapfile = layer_tablename+'.map';<BR>
> twms1 = new OpenLayers.Layer.WMS(<BR>
> layer_tablename,"<A href="http://localhost/cgi-bin/mapserv"
target=_blank>http://localhost/cgi-bin/mapserv</A>?",<BR>
> { map: mapfile,<BR> >
transparent: 'true', layers:layer_tablename,<BR>
> format: 'image/png',<BR>
>
projection:"EPSG:4326",reproject:false,<BR>
> units: "m",<BR> >
singleTile: true<BR> >
},{numZoomLevels : MaxZoomLevel});<BR> >
map.addLayer(twms1);<BR> ><BR>
> I am using the option of singleTile. Is there any
setting to<BR> be done in<BR>
> the map file or mapserver for it render a single
tile/single<BR> legend per<BR>
> image?<BR> ><BR>
> Thank you.<BR>
><BR> > Regards,<BR>
> Subha<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>
<mailto:<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>
><BR> ><BR>
><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>
<mailto:<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><BR><BR><BR>--
<BR>This message has been scanned for viruses and<BR>dangerous content by
*MailScanner* <<A href="http://www.mailscanner.info/"
target=_blank>http://www.mailscanner.info/</A>>, 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> <BR></BLOCKQUOTE><BR></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>