Share your Arcade expressions as templates

At the 2018 Dev Summit in Palm Springs, I introduced the Esri arcade-expressions GitHub repository, which can be used for creating Arcade expression templates to share with others for reuse.

Providing a mechanism for sharing Arcade expressions has been a popular request. This is our initial attempt at gauging interest among users and developers to see how sharing common Arcade expressions can ease some of your workflows.

At the time of this blog post, there are only four expressions included in the repo. Each is thoroughly documented so you can copy and paste the template into the Arcade editor in ArcGIS Online (or in your custom apps) and set the appropriate values and field names that match your dataset.

If you’re unfamiliar with Arcade check out the following resources:

Reusing expressions

Check out the Explore the Arcade Expressions GitHub Repository video on YouTube to quickly learn how the repository works.

Expressions are organized based on their intended execution profile, though it doesn’t necessarily mean they can’t be used in other profiles.

To reuse an expression, simply browse the profile folders (visualization, popup, labeling, alias, any) and select an expression listed in the General workflow section of the README. For example, click Visualization.

Then click predominance.

Read the general description of the expression along with the use cases.

The workflow section will highlight the portion of the template you need to be update for it to work for your data.

Copy and paste the snippet from the Expression Template section into your app/code and update the necessary parts of the expression as indicated in the “workflow” section and the code comments.

You should also see a section providing a live example of how the expression works with real data.

Contributing your Arcade expressions

This section briefly outlines how to contribute to this project. If you have nothing to share, then you don’t need to read any further. However, if you are interested in sharing some of the cool expressions you’ve found useful in your workflows, then please share them!

If you are unfamiliar with Git and/or GitHub, then check out the following resources for getting started:

To contribute, simply fork the repo, clone it locally to your machine, and add a new Markdown file describing the expression. Follow the same format as the existing expressions, providing others with a well documented template they can copy and paste easily into their apps. Also be sure to provide a completed example showing how the expression works for the given profile with a real dataset. Once that is done, submit a PR so your expression can be shared to the world.

The goal of this repository is to encourage collaboration and allow everyone to benefit from others’ creativity in using Arcade for solving real problems. Please share this repo and share your awesome Arcade expressions with the ArcGIS community!

About the author

Kristian is a Principal Product Engineer at Esri specializing in data visualization. He works on the ArcGIS Maps SDK for JavaScript, ArcGIS Arcade, and Map Viewer in ArcGIS Online. His goal is to help developers be successful, efficient, and confident in building web applications with the JavaScript Maps SDK, especially when it comes to visualizing data. Prior to joining Esri, he worked as a GIS Specialist for an environmental consulting company. He enjoys cartography, GIS analysis, and building GIS applications for genealogy.

Notify of
Inline Feedbacks
View all comments

Next Article

Connect Engineering and Environmental Teams on Projects with ArcGIS GeoBIM

Read this article