Create better mailing labels using Arcade

We ran a session on ‘Enhancing your Maps with Arcade’ at the Scottish Conference in October. One of my demos explored how you can generate better mailing labels in Web AppBuilder using a couple of simple Arcade expressions. I’m not a programmer and wanted to show that anyone can benefit from using Arcade!

For those that haven’t come across it before, Arcade is an easy to use expression language that allows you to drive visualisations, popup content and labels by a value returned from an expression rather than a field value. It’s secure and portable across the ArcGIS Platform, so, for example, you can create a label expression in ArcGIS Pro and it will work in an ArcGIS Online web map.

I love cycling, but I have asthma, so I’m keen to see improvements in the air quality across Edinburgh. I thought I’d explore how easily I could create a simple, hypothetical app that helps council staff engage local businesses in helping reduce air pollution.

I wanted to use the shops’ business name and address fields to generate a mailshot encouraging the businesses occupying them to report any badly polluting or idling vehicles in or near the air pollution monitoring sites. The app enables council staff to easily generate mailing labels for all the businesses within a selected area.

I created a web map using a couple of layers downloaded from The City of Edinburgh Council’s Open Data site (created with ArcGIS Hub) - air pollution monitoring sites and shops surveyed by the council a few years ago. I often use open data in my demos, but sometimes it just doesn’t quite suit my needs. I find that Arcade is great for improving the look of the data or dynamically creating new data on-the-fly from existing fields.

Create Arcade Expressions

I used a couple of Arcade expressions to improve the data I wanted to use in my web map popup:

1) I made the address field easier to read by changing the case from UPPER to Proper.

ProperCaseAddressFieldExpression.png
ProperCaseAddressFieldExpressionEditor.png

2) I created another expression to replace a text string. The last shops survey took place in 2010 and I know some shops reported as vacant no longer are. I didn’t want the word ‘vacant’ to appear in the business field that’s printed in the mailing label, so I substituted this with ‘Owner or Occupier’ so the letters are more appropriately addressed.

BusinessVacantReplacementTextExpressionEditor.png

Configure Popup

I configured my shops layer popup to use my two new Arcade expressions rather than the original fields.

CustomAttributeDisplay.png

Here’s the original popup using the layer’s fields and the new popup using my two Arcade expressions:

OriginalAndArcadePopups.png

To illustrate the change, I’ve left the title still showing the business name as ‘vacant’, but you can see that will no longer appear in the mailing label. Simple expressions can make such a difference to your map’s popups!

Mailing Label Web App

Arcade is supported in the ArcGIS Online Web AppBuilder Public Notification widget. This widget enables you to create mailing labels for selected features based on a layer’s popup.

In my app, you can search for an air pollution management area (or use an address or shape) and generate mailing labels for all shops within or nearby the selected area (or address).

Your address labels are created in a printable pdf like this…

MailingLabelsPDF.png

Thanks to Arcade, I have better formatted addresses and no business owner is going to receive a letter addressed to ‘vacant’!

There’s lots more you can do with Arcade. Check out…