jQuery AGS Legend is a jQuery plugin that will create a TOC type legend for an ArcGIS Server jsapi map object (esri.Map).
I wanted to write a jQuery plugin and use ArcGIS 10 stuff. So, here I am. Oh, and I needed something to present at the Charlotte ESRI Dev Meetup
It's life-changing: (if your life is especially boring)
- Legend symbols for many AGS layer types (hope to get them all at some point)
- Visiblity control of layers
- Uses the jQuery Templating plugin
- Uses Raphael
- REQUIRES ArcGIS 10 and the latest jsapi api from ESRI.
-
Check out the code from github:
git clone git://github.com/ruprict/jquery.agsLegend.git
-
Reference it in your HTML page, along with the templating plugin and Raphael.
-
Copy the script block from jquery.agsLegend.templates.js to the bottom of your HTML file
-
In your javascript, create an AGS map.
-
Then you can
legend = $('#toc').agsLegend({map:map});
where #toc is a unordered list object.
- Rock out
I dunno, maybe. There is a lot to be done, like:
- Support all symbols and layer types
- I haven't even thought about group layers yet
- Break up templates.txt into separate files for layer types
- Clean up template loading, big time
- Unit tests (I mean, c'mon, man.)
Feel free to clone it and add stuff and issue a pull request.