Highlight demographic data in a hosted table joined to a feature layer.
What is a hosted table?
A hosted table is a reference to a table in a feature service used to store your data. The table contains features (rows) with attributes but no geometry. Applications can use hosted tables to securely access, query, and edit data as stand-alone tables or as related tables.
You use a hosted table when you want to:
Import files such as CSV, XLS, or Google Sheets without geographic coordinate information.
Securely store collections of tabular data.
Optimize accessing a large amount of data.
Create related tables for other hosted layers.
Edit features and track edits.
Perform SQL queries.
Update or export data.
Use non-spatial data in offline applications.
How a hosted table works
The most common way to create a hosted table is to use data management tools to upload files such as CSV, XLS, GeoJSON, Shapefile, and File Geodatabase files. When a hosted table is created, an item and a feature service are also created. The item ID is a unique identifier for the table. You use an item page to manage a table and a feature service to access the data. Once the table is published, you can add and edit the table's data, fields, and columns.
Manage a hosted table
An item page allows you to manage the properties and capabilities for a hosted table. 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 hosted table 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 ArcGIS is https://www.arcgis.com. To use this URL, the item must be shared publicly.
You can view information about a hosted table 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 and fields. Most APIs will use the endpoint to perform other operations such as querying data.
You can use the ArcGIS REST API, ArcGIS Desktop, ArcGIS Pro, and the ArcGIS Maps SDKs to access hosted table data.
Get hosted table properties
To access a hosted table, or to get its properties, use the host, unique service ID, service name, and the layer ID.
To get hosted table data, use the host, unique service ID, service name, layer ID, and a query operation with parameters. You can provide a SQL query and return the data as HTML, JSON, or GeoJSON.
To display a hosted table, you reference the layer by its URL or ID and specify which data attributes to return. In this example, a hosted Trailheads hosted table is accessed and all of the records are displayed.
Steps
Get the hosted table URL and layer ID.
Add the hosted table and define the fields.
Display the fields and records.
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS API for PythonArcGIS REST JS
To display a subset of data from a hosted table, you can apply a definition expression using a SQL where clause. This example uses a definition expression to filter records by trail name for the Trailheads hosted table.
Steps
Get the hosted table URL and layer ID.
Create and execute a SQL query.
Display the records.
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS API for PythonArcGIS REST JS
You can combine the attributes from one dataset to another based on attribute relationships which creates new feature data. In this example, you use the JoinFeatures operation from the spatial analysis service to join the Trailheads_data hosted table to the Trailheads_locations hosted feature layer. The resulting layer displays the corresponding attribute information for trailheads.
Steps
Get the hosted table URL.
Get the feature layer URL.
Join the feature table to the feature layer.
Display the resulting layer from the join.
APIs
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS API for PythonArcGIS REST JS