Arcade Labeling Expression Help

183
2
01-24-2020 08:48 AM
Highlighted
New Contributor II

I'm labeling municipalities within a webmap on AGOL. I'm new to Arcade and am wondering if there is an Arcade expression that would allow labels to be visible only if they fit within there municipality(polygon), as to not clutter up the map? 

Thanks. 

Reply
0 Kudos
2 Replies
Highlighted
Esri Esteemed Contributor

Hi David Krady ,

I'm afraid that this is not possible for a number of reasons. The most important one being:

  • The label does not have a geometry (like a rectangle) which would be required to perform the analysis.
  • Please note that the label position depends on the part of the polygon that is visible in the map extent and the scale. The map extent and scale are dynamic and there is not way to pre-generate something that indicates if a label should be visible or not.

Best thing is to switch off labeling at a certain scale to avoid clutter.

Highlighted
New Contributor III

Hi,

If the feature class you want to label has an attribute for identifying the municipality in question, you could achieve this by making two layers.

So say for example, your feature class represents land parcels in your state. The feature class has an attribute which identifies the municipality the land parcel is in. 

Then create two layers of this feature class by querying:

layer 1: Municipality = 'x'

layer 2: Municipality <> 'x'.

Then you simply chose to label layer 1, and not layer 2.

If this makes for an ugly layer list or legend you can choose to make layer 2 invisible in these (if working with layout legends or web applications, also that is assuming you have the same symbology for the land parcels in this example).

Hope that's helpful!

Reply
0 Kudos