Ever open someone’s web layer and it struggles to draw or maybe needs to think for a few seconds to generate that pop-up? Meanwhile there’s layers like Census American Community Survey or hurricane forecasts that are fast as lightning. There isn’t some magical voodoo wizardry behind these silky smooth, performant layers. While some large, complex datasets take some real skill, many of the tricks for simpler layers can be boiled down to 5 easy steps that take only a few minutes to implement and will greatly improve your web layers.
Tip #1: Strip it down
Do you need all those fields? Do the data really need 6 decimals places? Make the amount of data as neat and compact as possible. Use integer instead of floating point, where possible. Round floating points to some reasonable precision. Reduce the maximum number of characters in a string length. If you imported data from Excel, the fields will default to 32,767 characters, which will choke your service. Also remember that some fields can also be calculated on the fly with Arcade if they’re only needed for pop-ups or symbology, which makes the table smaller and easier to load.
Tip #2: Add attribute indexes
Every time a pop-up needs to be generated, the client queries the server – and the same happens whenever a symbology is drawn or changed, or a Dashboard needs to graph the data. Adding attribute indexes to any field a user might query, filter, use in a pop-up or for symbology will greatly increase performance. In the Layer Settings, go to Manage indexes and configure the Field indexes. You can also use the Add Attribute Index tool in ArcGIS Pro.
Tip #3: Run Optimize Layer Drawing
Alright, you have the layer in ArcGIS Online either from publishing from ArcGIS Pro or from uploading a GDB (do not publish from ArcMap). Now what? After fully configuring your Content Item, head over to the Settings tab. In the Feature Layer section, click the Optimize Layer Drawing option and let that run a few minutes.
Tip #4: Cache the data on the CDN
After Optimize runs, scroll down to the last part of the settings page. You’ll see the cache is set to the default of 30 seconds. Now if your data is updating really fast, keep that. Most of us don’t run data updates every few minutes. For most layers, I crank that up to 1-hour. That means for 1-hour, any view, zoom level or query that someone makes will be held in memory.
Tip #5: Be careful with custom symbols
ArcGIS Online has some great symbol options, but sometimes we need to personalize the layer a bit more. If you go down this road, tread carefully. Here’s a few best practices that we’ve developed:
- Don’t use a large number of different custom symbols since it requires that many more queries to draw the layer.
- ArcGIS Online accepts SVG formats, which is best. Otherwise, use raster images no larger than 120×120 pixels.
- Export to an 8-bit PNG with transparency. Even better if they are 2 colors and can use 4-bit. Photoshop has an 8-bit in the legacy export “save for web” that works well if you’re not familiar with programs like ImageMagik.
- Apply the image in the Visualization tab of your Layer or View of the Item instead of the service itself. This trick prevents the image from being converted to a text encoded image in the service.
- Make sure your image is simple and legible at different scales. Emily Meriam has discussed some of her approach in this blog (scroll down to #4).
Go forth and update your layers with these tips to make everyone’s maps and apps work better!
Article Discussion: