[mapserver-users] show legend graphic with mapbuilder 1.5 and mapserver

Josh Hevenor jhevenor at rogers.com
Tue Jun 10 09:43:20 EDT 2008


First a note that your email text didn't come through in my list digest:

> Skipped content of type multipart/alternative-------------- next part
--------------

Now for legends. This might not be what you need but it's how I've worked with legends in mapbuilder before. So here's the app:

	http://www.eman-rese.ca/mapbuilder/demo/citsci/index.html

More specifically the map context is here

	http://www.eman-rese.ca/mapbuilder/demo/citsci/elements.xml

So we have MapBuilder showing a MapServer WMS layer. I set the legend graphic as part of the layer with

<Layer queryable="1" hidden="1">
	<Server service="OGC:WMS" version="1.1.1" title="WHC CitizenScience WMS">
		<OnlineResource xlink:type="simple" xlink:href="http://emandev.cciw.ca/cgi-bin/mapserver/whc_ows_demo.asp"/>
	</Server>
	<Name>LAND</Name>
	<Title>Land</Title>
	<SRS>EPSG:4326</SRS>
	<FormatList>
		<Format current="1">image/png</Format>
	</FormatList>
	<StyleList>
		<Style current="1">
			<Name>Default</Name>
			<Title>Default</Title>
			<LegendURL format="image/gif">
				<OnlineResource xlink:type="simple" 
						xlink:href="http://emandev.cciw.ca/cgi-bin/mapserver/whc_ows_demo.asp?
						VERSION=1.1.1&
						SERVICE=WMS&
						REQUEST=GetLegendGraphic&
						LAYER=LAND&
						STYLE=Default&
						FORMAT=image%2Fgif"/>
			</LegendURL>
		</Style>
	</StyleList>
</Layer>

So this should take care of the client end...If I can find that mapfile
again I'll pass along the WMS definition also.
Hope this helps,

Josh Hevenor



More information about the mapserver-users mailing list