GeoServer has code for this:
http://svn.codehaus.org/geoserver/trunk/src/wms/src/main/java/org/geoserver/wms/legendgraphic/

I don't think it will be able to run as-is without the GeoServer request
parsing infrastructure, but may be informative anyway.

--
David Winslow
OpenGeo - http://opengeo.org/

On Thu, May 10, 2012 at 10:49 PM, Michael Bedward <[email protected]
> wrote:

> Hi Rafael,
>
> Unfortunately, there is no legend widget in GeoTools presently. Your
> query is one of several about this in recent months so it's certainly
> a gap that would be nice to fill - though far from trivial to
> implement.
>
> If you want the legend to be displayed in the same viewport as the
> layers, one way to do it would be to sub-class DirectLayer and do the
> drawing in there. If the map styling is very simple you could probably
> get an ok result that way. If complex styles are used it's going to be
> hard.
>
> Ideally, legend creation would be done with SLD. Perhaps Andrea, Jody
> or other SLD gurus could offer some advice on any approaches worth
> exploring in that regard.
>
> Sorry I can't be more immediately helpful.
>
> Michael
>
>
> On 11 May 2012 11:51, Rafael Santos <[email protected]> wrote:
> > Hello there,
> >
> > I guess that the answer is "not easily", but I'd appreciate if someone
> > pointed me to the right direction. I have a MapContent with three layers
> > on it and I'd like to generate a simple legend for this map. Is that
> > possible?
> >
> > thanks
> > Rafael
> >
> >
> >
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > GeoTools-GT2-Users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to