12

Where can I find an example of a Table of Contents control to plug into the ArcGIS Server JavaScript API 2.3? Ideally it should support feature/dynamic/tiled layers; show symbology; and allow grouped layers. Transparency and zoom-to functionality would be ideal.

The Esri samples page is strangely lacking in any TOC examples - the nearest example is the extremely rudimentary Toggle Layer Visibility.

Answers to Kirk's question show a few templates but they don't contain a decent TOC. The ROK sample is close but doesn't show symbology or support feature layers (as far as I can see).

The TOC on the ArcGIS.com My Map viewer is almost exactly what I need. Has anyone managed to build something similar, or get this TOC working locally?

enter image description here

asked Jun 28, 2011 at 7:45
3
  • Something to consider: blog.davebouwman.com/2011/01/05/… Commented Jun 28, 2011 at 16:20
  • Derek, I agree that a focussed app is preferable - but sometimes you just need to concede to the user's expectations and provide some fine-grained layer control. The Stamen maps he mentions are awesome, but they each do one very specific thing (often as a proof-of-concept). A paying client often wants a single app which can be used by all staff, and a TOC makes this feasible. It's not so much of a compromise to add a sewer network or some census layers and have them off by default, if it means a whole extra division can suddenly use your site. Commented Jun 28, 2011 at 23:05
  • I have to agree with Stephen on this one. While there are times where a TOC shouldn't be used (ie. public facing apps), in many cases what my users are asking for cannot be done without building a TOC (especially when they are actually asking for one). I would consider these people to be "Professional Users". They aren't a GIS professional but require more than what should be offered to the general public. Commented Aug 31, 2011 at 15:57

6 Answers 6

6

Is this what you are looking for? I found it by searching the Code Gallery page on the ArcGIS API for Javascript Resource Center.

answered Jun 28, 2011 at 12:05
1
  • looks promising - I'll give it a go and report back whether it works. Thanks! Commented Jun 28, 2011 at 23:08
3

There's a new TOC sample called Table of Content/Legend Widget for JavaScript API by Nianwei Liu, which fits the bill almost perfectly. It doesn't (seem to) allow feature layers but this is a compromise I can live with since it answers the other requirements very well.

enter image description here

answered Aug 26, 2011 at 5:54
2

Here is a link to another example. This TOC/Legend is automatically generated by the layers in the MXD.

http://stlouis.esri.com/apps/exportmap/

It is part of one of the printing with ArcPy samples located below.

http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2011/04/12/An-introduction-to-arcpy.mapping-for-ArcGIS-Server-developers.aspx

-Mike

answered Aug 31, 2011 at 15:49
1
  • provided 1) link seems to be broken Commented Jan 8, 2013 at 15:05
1

There is a Table of Contents [TOC] Layer with Symbology with ArcGIS Javascript 2.3 is here at the bottom (in the the Footer)

http://help.arcgis.com/en/webapi/javascript/arcgis/demos/ed/ed_selectionmode.html

answered Jun 28, 2011 at 15:14
1
  • not exactly what I was looking for, but it's a nice approach to a TOC (which would probably work well on a tablet, with click on/off toggling). Thanks Commented Jun 28, 2011 at 23:11
1

I asked this question nearly 3 years ago - Esri have recently released the ArcGIS Web AppBuilder.

This contains an out-of-the-box Layer List widget, which is effectively a Table of Contents. It has some nice functionality built in, and the WAB framework handles the interaction with the current map layers.

enter image description here

Widgets are editable, so you should be able to extend or modify this as required.

answered Feb 23, 2015 at 23:05
0

In the years since I asked this question, there have been many changes in the ArcGIS Server JavaScript API. The latest version 4.x now contains an out-of-the-box LayerList widget.

It doesn't contain every item in my wish-list but is a great place to start.

enter image description here

answered Oct 11, 2020 at 23:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.