Table of Contents - Legend Widget for FlexViewer 2.x

98941
664
12-01-2010 07:30 AM
RobertScheitlin__GISP
MVP Emeritus
All,

Here is the next in my line of widgets for the FlexViewer 2.x.

The legend portion of this widget is the same code as my dynamic legend widget so,

IT IS FOR ARCGIS SERVER 10 OR GREATER ONLY

This is just a simple TOC Widget that includes my dynamic legend component.
This widget also includes my enhancement for map service transparency,
right click context menu for zoom to make layer visible, and my scale
dependent renderer for the TOC checkboxes.
Tags (2)
0 Kudos
664 Replies
RaymondBlack
New Contributor
Hi Robert,

Hope I didn't confuse you.  Your code for SP1 might help as I am only using SP1 map services.  The build 2800 refers to ArcMAP version 10 SP1 where I author the mxd.  I thought I needed to keep these versions in sync.  I am willing to give anything a go...

Cheers,

++ Ray
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ray,

    Here is the SP1 version.
0 Kudos
RaymondBlack
New Contributor
Magic Robert - Legend works perfectly.  Thank you very much.

Regards,

++ Ray
0 Kudos
philippschnetzer
Occasional Contributor III
using FlexViewer2.2, TOC2.2.1, AGS 10.1.  I would like my layers to be expanded when the widget is opened but the setting <expanded>true</expanded> in the TOCWidget.xml does not make this happen.....any ideas?
0 Kudos
giuseppemolinario
New Contributor
Hi Robert, Hi everyone -

I am making some laughable attempts at trying to incorporate these elements in my flexviewer app. without touching the flex code.

1. Layer switcher (Robert's TOC works great), 2. layer transparency (robert's TOC works great) and 3. raster and vector layer dynamic/static legend.

What I have found out is that this is impossible - I'm going to have to develop this combo of functionality myself or wait till someone cooler than me does it.

What I tried:

    esri LayerListWidget to switch my vectors, esri LegendWidget to show the legend for my vectors, esri sample ThematicQueryWidget to switch my raster layers and toggle a static image printed on the map with the legend of the displayed raster. --- Now this WORKS, but looks awful, truly very bad, and I get no layer transparency. 😞

    So I thought, let's try and use Robert's TOC and the esri  ThematicQueryWidget together - I get all the functionality I want. Hmmm - nope, not that easy, what's new. In this attempt I tried to use:

    [INDENT]
      robert's TOCWidget -
      [INDENT]
        I can get this to work, but I cannot figure out how to make it exclude from the TOC my imageservice raster's that are present in the map (how does the excludelayer tag work? can't figure it out)
      [/INDENT]
      [INDENT]

        - in the above experiment I could exlude my rasters from layerlistwidget and have them separately in thematicquerywidget (it made more sense)
      [/INDENT]

      [INDENT]
        Also, the legend tab, I don't want to see my baselayers there, and while I could live with the white background (but it's not ideal) I have my main vector layer that is a polygon feature whose symbology is a borderless white line - hence it dissappears in the legend and I can't see it.
      [/INDENT]

      [INDENT]
        But! it does give me transparency.
      [/INDENT]

    [/INDENT]

    [INDENT]
      I add now the thematicquerywidget,

      [INDENT]
        if it's active at the same time as the TOCwidget, they just won't work; they crash flash/and browser.
      [/INDENT]

      [INDENT]
        If i disable either one, the other works fine. frustration ensues.
      [/INDENT]

      [INDENT]
        if thematic query is on, i can switch between rasters and see my static raster legend image; if TOCwidget is on i have a layer switcher, transparency and a legend (which i dont like as much as the  standalone version). :confused:
      [/INDENT]

    [/INDENT]


I'm wondering, other than the obvious suggestion "go learn flex and make your own do-it-all widget/interface" ( a completely warranted answer) 🙂 is there any other advice you could give me on how to achieve my (i thought simple...but I come from mapserver/mapfiles...) goals?

Thanks again Robert for providing these tools and foruming tirelessly.

Giuseppe
0 Kudos
giuseppemolinario
New Contributor
Hi Robert, Hi everyone -

I am making some laughable attempts at trying to incorporate these elements in my flexviewer app. without touching the flex code.

1. Layer switcher (Robert's TOC works great), 2. layer transparency (robert's TOC works great) and 3. raster and vector layer dynamic/static legend.

What I have found out is that this is impossible - I'm going to have to develop this combo of functionality myself or wait till someone cooler than me does it.

What I tried:

    esri LayerListWidget to switch my vectors, esri LegendWidget to show the legend for my vectors, esri sample ThematicQueryWidget to switch my raster layers and toggle a static image printed on the map with the legend of the displayed raster. --- Now this WORKS, but looks awful, truly very bad, and I get no layer transparency. 😞

    So I thought, let's try and use Robert's TOC and the esri  ThematicQueryWidget together - I get all the functionality I want. Hmmm - nope, not that easy, what's new. In this attempt I tried to use:

    [INDENT]
      robert's TOCWidget -
      [INDENT]
        I can get this to work, but I cannot figure out how to make it exclude from the TOC my imageservice raster's that are present in the map (how does the excludelayer tag work? can't figure it out)
      [/INDENT]
      [INDENT]

        - in the above experiment I could exlude my rasters from layerlistwidget and have them separately in thematicquerywidget (it made more sense)
      [/INDENT]

      [INDENT]
        Also, the legend tab, I don't want to see my baselayers there, and while I could live with the white background (but it's not ideal) I have my main vector layer that is a polygon feature whose symbology is a borderless white line - hence it dissappears in the legend and I can't see it.
      [/INDENT]

      [INDENT]
        But! it does give me transparency.
      [/INDENT]

    [/INDENT]

    [INDENT]
      I add now the thematicquerywidget,

      [INDENT]
        if it's active at the same time as the TOCwidget, they just won't work; they crash flash/and browser.
      [/INDENT]

      [INDENT]
        If i disable either one, the other works fine. frustration ensues.
      [/INDENT]

      [INDENT]
        if thematic query is on, i can switch between rasters and see my static raster legend image; if TOCwidget is on i have a layer switcher, transparency and a legend (which i dont like as much as the  standalone version). :confused:
      [/INDENT]

    [/INDENT]


I'm wondering, other than the obvious suggestion "go learn flex and make your own do it all widget/interface" 🙂 is there any other advice you could give me on how to achieve my (i thought simple...but I come from mapserver/mapfiles...) goals?

Thanks again Robert for providing these tools and foruming tirelessly.

Giuseppe
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Giuseppe,

   I am working on getting you one step closer. I am adding support for excludelayer to the TOC portion of the code. The whole raster thing in the legend is not something I have even spent any time looking at. So tell me about why you would need raster data in the legend? What would the raster portion of the legend look like?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Giuseppe,

     There is a new version available that has the exclude layer capability.
0 Kudos
ChrisBruce
New Contributor III
Robert,

Thanks so much for providing this widget! I got it up and running in no time. Having the ability to adjust transparency is particularly useful for my application (I was bummed that ESRI removed that option from version 2.x).

I too have rasters in my map and when I was using the ESRI legend widget the 2 rasters that have a classified renderer did show up in the dynamic legend (the one raster I have displayed with a stretched renderer did not). It won't be too hard for me to work around this by converting the rasters to polygons but I just thought I'd point that out.

I also noticed an issue in the legend where I have layers classified by unique values. In a couple of cases I have multiple unique values grouped together and in these cases there are multiple entries showing up in the legend, whereas in the ESRI legend widget this was not the case (see attached screenshot). At any rate, I can certainly work around this as well and your widget is heaps better in many other ways.

cheers,
Chris
0 Kudos
giuseppemolinario
New Contributor
Giuseppe,

     There is a new version available that has the exclude layer capability.


Hi Robert,

Thanks for your reply. What I am wishing for (and I understand it may just stay a wish) is to have an advanced layer selector/legend widget which works seamlessly and dynamically with both raster and vector. An added bonus would be your transparency feature. Right now my webGIS has all the cool flexy looking interface, but from a GIS perspective, it is worse than IMS? this is very very sad.

Don't get me started on why ESRI would not spend some time developing a basic necessity (above said widget), as we all know that a map without a legend.....exactly....so why even make us go through all this plain to include a "separate" legend. I was dumbfounded in the previous version to see that the legend widget was not even included, what? wow.

So I have vector layers, i have raster layers, I am giving my users the option of turning them on and off dynamically, and i want the legend to behave correspondingly. If they can put a raster in transparency (we are talking landsat composites for a region the size of central africa- beautiful stuff) that would be great. I don't want three widgets on my map to do that, and i don't know how to write code in FLEX (yet).

So here is my hacked version: http://congo.iluci.org/carpemapper/

The "raster selector" on the left works only for the "facet" image (thats another problem-unrelated).

Also I saw someone replied on th thread that got rasters to display the legend in the esri legend widget. I will take a look.

Thanks again  - cheers,

Giuseppe
0 Kudos