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:
- ArcGIS Blog: Introducing Arcade
- How to Smart Map: Arcade
- ArcGIS Blog: Use Arcade Expressions to Map Your Ideas
- ArcGIS Blog: Using Arcade expressions in web apps
- ArcGIS Blog: Create a predominance visualization with Arcade
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:
- Git Basics
- GitHub Guides: Open a Pull Request
- Esri support blog post with tips on getting started with GitHub
- Esri guidelines for contributing to GitHub repositories
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!