HOW TO

Delete a hosted feature layer from a group layer using ArcGIS REST API in ArcGIS Online

Last Published: April 12, 2024

Summary

If a layer is no longer relevant or required within a group layer, deleting it from the group keeps the data layers in ArcGIS Online organized. Deleting a layer from a group layer requires the use of ArcGIS REST API in ArcGIS Online. ArcGIS REST API is useful when it involves projects with large data. In this example, six feature layers are grouped within a single group layer.

A group layer containing six feature layers.

This article provides the workflow to delete a feature layer from a group layer using ArcGIS REST API in ArcGIS Online.

Procedure

  1. Log in to ArcGIS Online.
  2. On the Content page, browse to the desired hosted feature layer, click More Options The more options icon. and select View details.
  3. On the Overview tab, next to URL, click View to open the ArcGIS REST Services Directory window.
URL of the feature layer containing the View button.
  1. In the ArcGIS REST Services Directory window, click Admin. Scroll down and click Delete From Definition.
Header in the ArcGIS REST Services Directory window containing the Admin option.
Footer in the ArcGIS REST Services Directory window containing the Delete From Definition option.
  1. In the Delete From Service Definition text box, retrieve the ID number of the layer to delete. In this example, the layer to delete is Layer_B and the ID number is 2.
Delete From Service Definition text box containing codes.
  1. Delete the text inside the Delete From Service Definition text box.
  2. Specify the following code in the Delete From Service Definition text box. Replace <ID_NUMBER> with the ID number of the layer to delete.
{
  "layers": [
    {
      "id": ""
    }
  ]
}
Delete From Service Definition text box with code to delete features.
  1. Click Delete From Service Definition.
  2. Click Close The close button icon to close the ArcGIS REST Services Directory window.
  3. Refresh the Overview tab, and the updated layers are displayed in the Layers section.

The image below shows the remaining layers on the web map after deleting Layer_B from the group layer.

Group layer in web map after deleting the desired feature layer

Article ID: 000032303

Software:
  • ArcGIS REST API
  • ArcGIS Online

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options