Feature layers displaying trailhead, trail, and park data stored as hosted feature layers
What is a hosted feature layer?
A hosted feature layer is a reference to a feature layer in a feature service used to store your data. A feature layer is a spatially-enabled table that contains features with a geometry and attributes. Applications can use feature layers to access, query, edit, and display features in a map or scene.
You use a hosted feature layer when you want to:
Import files such as CSV, XLS, or Google Sheets with coordinate information.
Store collections of geometry and attribute data as features.
Access and display features in maps and scenes.
Securely share data with applications and users.
Optimize accessing and displaying large amounts of features.
Edit data and track edits.
Perform SQL or spatial queries.
Update or export data.
Use feature data in offline applications.
How a hosted feature layer works
You create a hosted feature layer by using data management tools to import files such as CSV, XLS, GeoJSON, Shapefile, and File Geodatabase files or by publishing feature data. When a hosted feature layer is created, an item and a feature layer in a feature service are created. The item ID is a unique identifier for the layer. You use an item page to manage a feature layer and a feature service to access the data.
Access hosted feature layers and feature services from your applications.
Manage a feature layer
An item page allows you to manage the properties and capabilities for a hosted feature layer. You can access an item page by signing in to your developer dashboard or ArcGIS Online. You can set properties such as the name, description, and tags, as well as sharing, editing, and index settings.
View a feature layer item page
To access an item page directly, use a portal search URL with the ID for the item. The portal URL for data hosted in the ArcGIS Platform is https://www.arcgis.com. To use this URL, the item must be shared publicly.
You can discover information about a feature layer by accessing the feature service endpoint with the layer ID. The ID is typically an integer such as "0" if there is only one layer in the feature service. Accessing the endpoint in a web browser allows you to view properties such as the name, geometry type, drawing information, extent, and fields. Most APIs will use the endpoint to perform other operations such as querying data.
Get feature layer properties
To access a feature layer or get properties, use the host, unique service ID, service name, and the layer ID.
To get feature layer data, use the host, unique service ID, service name, layer ID, and a query operation with parameters. You can provide a SQL or spatial query and the data can be returned as HTML, JSON, or GeoJSON.
To display a hosted feature layer, you reference the layer by its URL or ID, and then add it to a map or scene. The API communicates with the feature service to retrieve data for the current visible extent. ArcGIS APIs optimize data access by utilizing feature service functionality such as spatial indexes and caching. APIs also need to specify which data attributes to return.
Steps
Create a map or scene.
Get the hosted feature layer URL.
Add the layer.
ArcGIS JS APIEsri LeafletMapbox GL JSOpenLayersArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
To retrieve a sub-set of data for a hosted feature layer, you can query features using a spatial relation and a geometry. This example uses a spatial query to access a sub-set of parcels from a feature layer that contains 2.4 million features.
Steps
Create a map or scene.
Get the hosted feature layer URL.
Create and execute a spatial query.
Show the features.
ArcGIS JS APIEsri LeafletMapbox GL JSOpenLayersArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)
To retrieve a sub-set of data for a hosted feature layer, you can query features using a SQL where clause. This example uses a SQL where clause to access a sub-set of parcels from a feature layer that contains 2.4 million features.
Steps
Create a map or scene.
Get the hosted feature layer URL.
Create and execute a SQL query.
Show the features.
ArcGIS JS APIEsri LeafletMapbox GL JSOpenLayersArcGIS .NET APIArcGIS Android APIArcGIS iOS APIArcGIS Java APIArcGIS Qt API (C++)ArcGIS Qt API (QML)