Create a feature layer

Creating a feature layer in portal is a important process for working with spatial data. A feature layer represents geographic features, such as points, lines, or polygons, and associated attributes. This layer can be used to visualize, analyze, and share spatial information. The process involves uploading or creating data, configuring the layer's properties, and publishing it as a feature layer that can be accessed and used by other users or applications. This section will describe the process of creating a feature layer, publishing it as a feature service, and adding features to it.

Why create a feature layer

You create a feature layer to:

  • Import existing file or Excel spreadsheet data into ArcGIS
  • Store spatial data like points, polylines, and polygons.
  • Store string and numeric data in fields.
  • Store attachments with features.
  • Store and access features in different formats (JSON, GeoJSON, or PBF).

How to create a feature layer

The general steps to create a feature layer:

1. Sign into a portal

Sign in
Sign in page for ArcGIS portal.

Sign into your portal to use data management tool with your ArcGIS account:

2. Use tools to create feature layer

New item
New item window with Feature layer option selected.

Use the data management tool to create the following:

  • Hosted feature layer: A new item in your portal to manage the item properties and service settings.
  • Feature layer and feature service: A new feature layer in a feature service for the data.

Below are instructions to create a basic feature layer:

  1. In the Contents tab of your portal, click New item > Feature layer.
  2. In the Select an option to create an empty feature layer, select Define your own layer.
  3. In the Specify name and type, set the layer name and feature layer type.
  4. At the minimum, provide values for title, tags, and summary.

Code examples

Create a point feature layer

An example that shows how to create a point feature layer in your portal:

ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
                    // After adding the feature, save it to your portal
                    portal.load().then(() => {
                        // Get the user's content
                        const userContent = portal.user.content;

                        // Add the feature layer as an item to ArcGIS Online
                        userContent.add(layer).then((item) => {
                            console.log('Feature layer added to ArcGIS Online:', item);
                        });
Expand

Create a point feature layer with point features

An example that shows how to create a point feature layer with point features:

ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS API for Python
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
                    userContent.add(featureLayer).then(function(item) {
                        console.log('Feature layer added to ArcGIS portal:', item);
                    });

                    featureLayer.applyEdits({
                        addFeatures: [{
                            geometry: geometry
                        }]
                    }).then(function() {
                        console.log('Point feature added to feature layer.');
                    });
Expand

Create a feature layer from a CSV file

An example that shows how to create a feature layer from a CSV file in your portal:

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Path to your CSV file
csv_file_path = r"path/to/your/csv/file.csv"

# Specify properties for the feature layer
item_properties = {
    "title": "My CSV Feature Layer",
    "tags": "csv, feature layer",
    "type": "CSV"
}

# Add the CSV file as an item to ArcGIS Online
csv_item = gis.content.add(item_properties, csv_file_path)

# Publish the CSV file as a feature layer
feature_layer_item = csv_item.publish(None)

# Share the feature layer with everyone (optional)
feature_layer_item.share(everyone=True)
Expand

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.


Services

API support

SearchItemsUsersGroupsSettingsSecurity
ArcGIS Maps SDK for JavaScript1111
ArcGIS Maps SDK for .NET1111
ArcGIS Maps SDK for Kotlin1111
ArcGIS Maps SDK for Swift1111
ArcGIS Maps SDK for Java1111
ArcGIS Maps SDK for Qt1111
ArcGIS API for Python
ArcGIS REST JS
Esri Leaflet222222
MapLibre GL JS222222
OpenLayers222222
Full supportPartial supportNo support
  • 1. Limited operations, use HTTP requests.
  • 2. Access via ArcGIS REST JS.

Tools

Use tools to access the portal and create and manage content for applications.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.