0

In my layout view in ArcGIS Pro (2.9), I want to add a title that displays the currently selected parcel in the map frame. I have looked through the dynamic text tags and the table attribute option is close, but I need to limit it to just the selected parcels. Is there an expression I can use that would only use the attribute data for the selected parcels?

3
  • 1
    Is the map part of a map series? So you going to churn out dozens of maps? If it is just one map, then quicker to do it manually. Commented Nov 7, 2022 at 14:59
  • No it's not a map series, but it's a process my editors use regularly. Before beginning an edit process, they create a before map to include in the documentation. So I have a layout template set up for them and the last piece would be for it to automatically title the map based on the selected parcel. Commented Nov 8, 2022 at 15:05
  • 1
    If all the maps are about the same set of parcels, then Hornbydd's suggestion of a map series still might make sense. Each parcel would be a page in a map series, when they choose a parcel they would go to the map page for that parcel and export a single map of it, not the whole series. The map series setup allows you to use auto fills and selection symbologies and even different inserts even if you only produce one map at a time. Commented Nov 9, 2022 at 0:30

2 Answers 2

0

I'm pretty sure what you are asking is not possible as I believe the current release of Arcade does not honour selections. Also the Layout profile of Arcade seems to only accept $feature global.

There is a work around but it requires a little bit of effort by you:

  1. Add a text field of 1 character length, call it selected.
  2. Select your parcels
  3. Run a field calculate on your text field selected and set it to Y.
  4. Switch selection
  5. Re-run the field calculate on the text field selected and set the rows to N.

In your layout add the table attribute dynamic text and set it up as below:

Field drop-down is the parcel name/ID/some bit of text. This is being filtered by rows where selected = 'Y'.

Table Attribute

An advantage of this approach is that you can list the select parcel names in your title because you are filtering by an SQL query so you can actually clear the selection on the layer.

0

To avoid modifying the data, I would suggest writing a tool in Python to:

  1. Prompt the editor to identify the feature layer that contains the selected features.
  2. Prompt the editor to identify the field to use for the map title.
  3. Loop through the selected features using a Search Cursor to concatenate the attributes into a single string.
  4. Use the listElements method on the layout to select the map title object and update the text attribute using the value obtained from 3.

If the maps mentioned by the OP are a standard product, you could hardcode 1. and 2. to make the tool a bit simpler.

The outline of the tool could look like this:

import arcpy from arcpy import mp aprx = mp.ArcGISProject("CURRENT") map = aprx.activeMap layout = aprx.listLayouts()[0] # select the first layout in the project # get editor input from the tool GUI layer_name = arcpy.GetParameterAsText(0) field_name = arcpy.GetParameterAsText(1) layer = map.listLayers(layer_name)[0] # This assumes that there are selected features in the layer. attributes = [] with arcpy.da.SearchCursor(layer, [field_name]) as rows: for row in rows: attributes.append(row[0]) attributes = sorted(list(set(attributes))) # this gets rid of duplicates and sorts the values map_title = ", ".join(attributes) map_title_element = layout.listElements("TEXT_ELEMENT", "Map_Title")[0] map_title_element.text = map_title # save the project and/or print and/or just end the tool and pass control back to the editor. 

Error handling would obviously need to be included, but this should be a good start for anyone unfamiliar with writing simple tools for interacting with the Layout in ArcGIS Pro.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.