ArcGIS Blog

Mapping

ArcGIS Online

A better experience for styling layers using Arcade in ArcGIS Online

By Kristian Ekenes

The December 2021 update of ArcGIS Online added performance updates for the user experience when styling layers using Arcade expressions. The faster performance is especially noticeable in very large layers.

For example, suppose you authored an expression based on numeric data and classified it into categories.

An Arcade expression that classifies sea surface temperature values as either hot, warm, cold, or freezing.
An Arcade expression that classifies sea surface temperature values as either hot, warm, cold, or freezing.

Prior to the update, the browser might have frozen for several seconds in this scenario. That can feel like an eternity in online workflows.

Animation showing the map viewer UI freezing from slow calculations.

After the update, the performance is nearly 10 times faster for calculating unique values.

Animation showing the map viewer UI updating quickly from faster calculations.

There is also a noticeable improvement when configuring additional properties for continuous color and size styles. Initially, the suggested style is generated quickly. However, if you want to modify the settings, you might have encountered similar UI freezing.

In the recording below, notice how it takes a long time for the histogram to generate and render on the slider.

Animation showing the map viewer UI freezing from slow calculations.

Similarly, you would have to wait through several seconds of UI freezing if you toggled the switch for classifying data. Again, the delay makes the user feel like the app is broken.

Animation showing the map viewer UI freezing from slow calculations.

As of the December update, the styling panel now opens immediately, rendering the histogram on the slider in less than a second. The performance is also improved for class breaks, calculating the breaks in less than a second. This is much faster, making for a more pleasant experience when styling layers.

Animation showing the map viewer UI updating quickly because of faster calculations.

What changed?

The styles panel uses Smart Mapping to help users make smarter choices about styling their data. This means empowering you with information, including statistics and histograms annotated with critical values that summarize the spread of a dataset. It also provides access to interactive sliders, controls, symbols, and hundreds of well-designed color ramps that give you control over finishing what smart mapping starts.

Smart mapping calculates summary statistics and histograms to help you understand your data better. The speed of these calculations significantly improved for Arcade-based styles in the latest update of ArcGIS Online.
Smart mapping calculates summary statistics and histograms to help you understand your data better. The speed of these calculations significantly improved for many styles in the latest update of ArcGIS Online.

When you select a field in a service-backed layer, the statistics and histogram Smart Mapping provides you are queried directly from the server. However, when you author an Arcade expression, the Map Viewer must calculate statistics from the expression directly in the browser since feature services don’t support Arcade.

Calculating these statistics used to be burdensome because they previously executed on the browser’s main thread. That is what caused the freezing observed in the recordings at the top of this post. In December, the logic for calculating statistics moved from the main thread to worker threads. This prevents UI freezing and returns the results faster.

An illustration of long lines of people checking out food at a grocery store.
Credit: AdrianHillman/iStock/Getty Images Plus

You can think of this as standing in line to buy food at a grocery store register. Imagine having a cart full of food and discovering that only one register is open with a line of other shoppers backing up to the end of the store. Compare that experience with having 10 open registers with quickly moving lines. This allows you to choose the shortest line so you can make your purchase and leave the store faster.

In a similar fashion, the statistic calculations previously had to wait in a queue of other tasks to finish their calculations. Now they have moved to smaller queues (i.e. workers), which means they can be resolved more quickly without blocking other logic in the app.

Creating a good experience for non-ArcGIS data sources

The logic for calculating statistics for Arcade expressions is the same code path as calculating statistics for any data source not backed by an ArcGIS feature service or map service. Since data sources, such as GeoJSON and CSV, exist as text files, the browser needs to bear the burden of calculating statistics for data from those layer types.

The performance improvements described above helped create a good experience for styling data in CSV and GeoJSON layers, which can now be added to ArcGIS Online maps by URL starting at the December 2022 update.

Go ahead and try it out today! Click the Add option at the top left portion of the app, and select either CSV or GeoJSON from the menu.

The ArcGIS Online map viewer with the Add menu expanded, showing the various layer types that may be added to the map.

Then paste the URL to the resource you would like to add to the map.

The ArcGIS Online map viewer showing the menu for pasting a url to a CSVLayer to add to the web map.

Once the data is added, you can configure the layer’s style, filters, popups, and labels as you would any other FeatureLayer.

Animation showing how to style a CSVLayer and cluster it.

Thanks to the performance improvements for generating statistics within the browser for client-side data, mapping and exploring data from CSV and GeoJSON data sources will be fast and highly interactive.

Share this article

Subscribe
Notify of
2 Comments
Oldest
Newest
Inline Feedbacks
View all comments