The Optimized Layer Drawing setting for a hosted feature layer (item) allows you to improve the performance and scalability when displaying features in feature services.
What is drawing optimization?
Drawing optimization is a setting for polyline and polygon feature layers that are used to increase the client-side performance of drawing features with geometries that have highly dense vertices. This optimization is helpful for applications that display complex features at small or medium scales (zoomed out) and still need to maintain the appropriate level of detail at larger scales (zoomed in). Examples of features that typically contain highly dense geometries are zip code boundaries, coastlines, and highways.
How drawing optimization works
When drawing optimization is enabled, the feature service stores multiscale geometries (at lower densities) for each feature in the feature layer. It stores this information in the layer multi
property. For clients that query
with the max
and/or quantization
parameters, the server will use the closest multiscale stored geometry to generate the reduced resolution response. Using these parameters in conjunction with the drawing optimization service feature can greatly improve the time it takes for the server to generate that reduced resolution response.
How to manage drawing optimization
The steps to manage drawing optimization settings are:
-
Sign into a data management tool with your ArcGIS account:
- Go to ArcGIS.com and sign in to your portal (ArcGIS Location Platform or ArcGIS Online)
- ArcGIS Enterprise portal (ArcGIS Enterprise)
- Find the item.
- Use the Settings tab in an item page and Click the Optimize layers button.
Code examples
You can use data management tools to manage the drawing optimization settings of a hosted feature layer (item) or you can use the ArcGIS REST APIs. The following examples illustrate how to programmatically get the properties and then modify the drawing optimization settings of a hosted feature layer (item).
Get layer drawing optimization properties
This example uses a Feature Service URL to get the current properties of a feature service layer. If the repsonse contains properties in the multi
, then the layer has optimization enabled.
Request
POST https://{host}/rest/services/{service_name}/FeatureServer/layers HTTP/1.1
&f=json
&token={access_token}
Response
{
"layers": [
{
"currentVersion": 11.1,
"id": 0,
"name": "{service_name}",
"type": "Feature Layer",
"serviceItemId": "{service_id}",
"displayField": "",
"description": "",
"copyrightText": "",
"defaultVisibility": true,
"editingInfo": {
"lastEditDate": 1688393835811,
"schemaLastEditDate": 1688393835811,
"dataLastEditDate": 1676666003794
},
"multiScaleGeometryInfo": {
"levels": [7, 9, 11, 13],
"generalizationType": "Quantization"
},
"relationships": [],
"isDataVersioned": false,
"hasContingentValuesDefinition": false,
Set layer drawing optimization
This example shows you how to use the updateDefinition admin operation to enable multi
on a feature service layer. Passing in an empty array will start the server side build process, which can be monitored with the returned status URL. To disable optimization, use {"multi
Request
POST https://{host}/rest/admin/services/{service_name}/FeatureServer/{id}/updateDefinition HTTP/2
&updateDefinition={"multiScaleGeometryInfo":{"levels":[]}}
&f=json
&token={access_token}
Response
{
"success":true
}
Tutorials
Import data to create a feature layer
Use data management tools to import files and create a feature layer in a feature service.
Define a new feature layer
Use data management tools to define and create a new empty feature layer in a feature service.
Manage a feature layer
Use a hosted feature layer item to set the properties and settings of a feature layer in a feature service.
Create a vector tile service
Use data management tools to create a new vector tile service from a feature service.
Create a map tile service
Use ArcGIS Online or scripting APIs to publish a map tile service.
Workflows
Create a feature service for an app
Learn how to import parcel data, create and style a feature layer, and then access the features in an app.
Create a feature layer view for an editor app
Learn how to import parcel data, create and style a feature layer view, and then access the features in an editing app.
Create a vector tile service for an app
Learn how to import parcel data, style a feature layer, and then create a vector tile service for an app.
Create a map tile service for an app
Learn how to import contour data, style a feature layer, and create a map tile service for an app.
Services
Feature service
Add, update, delete, and query feature data.
Vector tile service
Store and access vector tile data.
Map tile service
Store and access map tile data.
Image service
Store and access imagery and raster data.
API support
Use data management tools or Client APIs to create, manage, and access data services. The table below outlines the level of support for each API.
- 1. Use portal class and direct REST API requests
- 2. Access via ArcGIS REST JS
- 3. Requires manually setting styles for renderers