6

I'm using ArcMap 9.3.1 and have a point feature with an attribute table like this:

enter image description here

What would be the easiest way to generate a legend like this?

enter image description here

Generating different tables (feature classes) for each of the 3 states is no solution since the table is growing over the next month and it would be nice to use the same layout for other data as well.

I thought of creating 3 legends (one for each category) but wasn't able to display entries with a specific state.

4
  • Have you try using Multiple Attributes under symbolology.
    – saviour123
    Commented Aug 11, 2016 at 19:59
  • @saviour123 I played around with that option but I have no clue how this can help me to get the expected legend
    – Simon
    Commented Aug 12, 2016 at 16:15
  • 2
    Interesting question. I guess the best way would be a python snippet that would go to fetch the categories and use them to update "group" values in the legend each time you press a button (for example). I hope you get an answer :)
    – gisnside
    Commented Aug 14, 2016 at 10:21
  • 1
    I think @RobinP is right. In the past I struggled with a similar issue and my solution was to fetch all categories and values in to Python dictionary and write them back into a text box with tab indentations. This solution though requires you to run the script after each and every change in the layer or before publishing your map to make sure it reflects the true state of the categories.
    – fatih_dur
    Commented Aug 16, 2016 at 14:18

4 Answers 4

10
+50

Here is one solution on top my head:

  1. Create a new string field and use field calculator to compute as the concatenation of other fields. Here is the python snippet:

    !abbrev! + ' ' + !fullname1! +' ('+ !fullname2! + ')'

  2. Copy the layer twice in the ArcMap TOC to have three versions of the same layer.

  3. Go to properties of each layer and fill the definition query and select the features of the same category. for example:

    • First Layer: status = 'V'
    • Second Layer: status =3``
    • Third Layer: status = '-'
  4. Rename the layers to their corresponding category i.e. Layer1 - V

Just make sure all layers are visible. No further action is required in the legend creation process (use the defaults). Once your feature class is updated the changes would be reflected in all three layers!

To address @RobinP comment:

The procedure that I described here can be automated using a python script or even model builder. The combo would be:

  1. CalculateField_management tool
  2. a search cursor to get the unique categorical values. In ModelBuilder, use the "Iterate Field Value" function. One needs to check the Unique values box to make sure they are unique.
  3. MakeFeatureLayer_management tool to duplicate the layer and use the where_clause parameter for the definition query. The new layer name could be set too. No need to rename the layer manually.
7
  • 2
    There might be a downside to your solution. For example if Simon was to add like 35 new categories (for example). The problem in this solution is that's it requires some manual edition category by category. I would then suggest to use a split layer by attribute type tool. Even if you do technically answer the question, I would be very interested if somebody would made up an 95% automatic way without splitting the layer and using the group method (see fatih_dur answer). TDavis describes well the manual manipulation corresponding to what needs to be automated.
    – gisnside
    Commented Aug 17, 2016 at 10:37
  • See the updated answer! Commented Aug 17, 2016 at 11:39
  • 1
    Seems much better indeed. You can add also that in ModelBuilder, what you call the search cursor is the "Iterate Field Value" function if I'm correct. One needs to check the Unique values box to make sure they are unique.
    – gisnside
    Commented Aug 17, 2016 at 13:32
  • Nice input Robin. The OP will find your comment helpful. Commented Aug 17, 2016 at 14:02
  • Thanks, I realized i could edit your message so i added this info.
    – gisnside
    Commented Aug 17, 2016 at 14:44
4

you can group your symbology items under headings. using ctrl-clicking to select all the items for a category, right click and 'move to heading/new heading...' and name the new heading 'category x' and repeat for each category, and make sure to set the legend format to show the heading names. to add the fullname2 text, using the field calculator to concatenate the strings: newfield= [fullname1] & " (" & [fullname2] & ")". and use the new field as the unique value category.

4
  • 1
    That's what needs to be automated :)
    – gisnside
    Commented Aug 17, 2016 at 10:38
  • I don't think automation was referenced in the question, though certainly it would be much simpler than manually building the category headings if multiple layers are involved.
    – TDavis
    Commented Aug 17, 2016 at 15:10
  • It works for me, you are the best answer !!!! Above acept answer works, but complicated, not necessary to make things so complicated.
    – hoogw
    Commented May 3, 2021 at 15:06
  • This should be best answer !!!!!!! It works perfect for me.
    – hoogw
    Commented May 3, 2021 at 16:53
3

I encountered same problem back some time. The easiest approach I used was a little out of the box. Since all the shapefiles contain one .dbf file containing all the data that easily opens into excel worksheet. Using simple pivot table can give u your desired results/legends in less then a minute. You can always copy paste your legend in the ArcMap. Here is a simple tutorial for using pivot tables, in case you need.

https://support.office.com/en-us/article/Create-a-PivotTable-to-analyze-worksheet-data-A9A84538-BFE9-40A9-A8E9-F99134456576

0

You need add heading in symbology tab, here is my sample:

click zone_merge layer, open layer properties, click symbology tab

now, click the item for example, VC village commercial,

right click it, choose, "move to heading", choose 'new heading'

Then, you can click others, choose move to heading, .... and so on.

when you save

the legend will automatically show the grouped legend as expected.

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.