1. Prepare feature data
The preliminary step for most feature analyses is to prepare input feature data
There are a number of ways you can prepare data for analysis, but the easiest way is to use ArcGIS software and tools such as ArcGIS Online, Map Viewer, and ArcGIS Pro. These tools provide an interactive way to find, import, and prepare data.
Regardless of the tools or APIs you use, the analysis service
The input data for an analysis is not changed by the analysis service
How to prepare data
The different ways to find or create input data for feature analyses are listed below:
- Find existing data: You can use existing data sources hosted in ArcGIS as input for analyses. The data sources need to be in the format of a hosted feature layer
A hosted feature layer is a hosted layer (item) in a portal that is used to manage the properties and settings of a spatially-enabled feature layer in a feature service. or table. For example, you can use hosted feature layers such as USA census block groups or World Demographics.
Below is a list of resources that you can use to search for input data for analyses:
To learn how to find data with these tools, go to the Find data sources tutorial.
-
Import data as a feature layer: If you have existing point, line, or polygon data with attributes, you can use the portal
ArcGIS portal, also known as a portal, is a website with applications and tools that can be used to create, manage, access, and share geospatial content and data. It supports security and authentication, developer credentials, content and data service management, user and group management, and site administration. A portal can be hosted in Esri's infrastructure or your own infrastructure. to import the data and create your own hosted feature layers for analyses. You can import different formats such as CSV, XLS, shapefile, or GeoJSON. Once your data is hosted, the feature layer can be used as input for feature analysis using ArcGIS tools or APIs.To learn how to import data, go to the Create data sources tutorial.
-
Feature collection (JSON): If you are programmatically accessing the spatial analysis service, you can also create a feature collection as a JSON structure and use it as input for the analysis.
To learn how to format a feature collection, go to FeatureSet in Common data types.
-
Enrich data: If you want to add demographic or local facts data attributes to an existing hosted feature layer such as USA census tracks, you can use the GeoEnrichment analysis.
To learn how to enrich data, go to the Enrich data sources tutorial.
2. Select an operation
You can perform many different types of analyses with the feature analysis service
| Category | Description | Operations | Result | Example |
|---|---|---|---|---|
| Find data | Selects a subset of features | Find, Derive, Extract | A new feature collection |
Finds existing polygons that match a SQL query. |
| Combine data | Combines or joins features from two or more feature datasets | Merge, Overlay, Join, Dissolve | A new feature collection |
Dissolves polygons from two input feature datasets. |
| Summarize data | Aggregates or summarizes feature data | Aggregate points, Summarize nearby, Summarize within, Summarize center and dispersion | A new feature collection |
Aggregate points into polygons. |
| Analyze patterns | Identifies spatial patterns and relationships in feature data | Find hot spots, Find outliers, Find point clusters, Find similar locations, Calculate density, Interpolate points | A new feature collection |
Find hot spots based on attribute values |
| Calculate geometries | Performs geometric calculations on existing features | Create buffers, Create centroids, Generate tessellations, | A new feature collection |
Generate and merge buffers around features. |
3. Perform the analysis
ArcGIS tools and APIs for analysis
To perform feature analysis, you can use different ArcGIS software and tools
Below is a list of the different tools and APIs you can use:
-
ArcGIS software and tools: These are applications such as Map Viewer
Map Viewer is a browser-based mapping tool that can view, create, and save web maps. It can also perform mapping, visualization, and spatial analysis operations. or ArcGIS ProArcGIS Pro is a professional desktop GIS application that can explore, visualize, analyze, and manage 2D and 3D data. that you can use to perform analysis interactively, to experiment with different analyses and parameters, and to visualize the results. If you are new to ArcGIS, it is recommended to start with these tools. For documentation and tutorials, go to ArcGIS Online analysis and ArcGIS Pro Analytics. -
ArcGIS APIs: These are programming APIs such as ArcGIS API for Python or ArcGIS REST JS that you can use to access the spatial analysis service
A spatial analysis service, also known as a feature analysis service, is a service used to perform spatial analysis operations on feature data such as finding, comparing, summarizing, analyzing patterns, and calculating geometries. . Use these APIs to build custom applications. -
ArcGIS REST API: This is the API you use to directly access the spatial analysis service
A spatial analysis service, also known as a feature analysis service, is a service used to perform spatial analysis operations on feature data such as finding, comparing, summarizing, analyzing patterns, and calculating geometries. . Use the REST API to build custom applications that access the service with HTTP requests.
You can use different ArcGIS tools
Security and authentication
To access the spatial analysis service
Job processing
All feature analysis requests to the spatial analysis service
ArcGIS software and tools
You can use the Map Viewer
The general steps to perform a feature analysis with the Map Viewer are:
- Go to the Map Viewer and login in with your ArcGIS Online account.
- Identify one or more hosted feature layers to be used as input data and add them to the map.
- Go to Analysis tools.
- Select a tool, set the parameters (with the input hosted feature layer), and execute the analysis.
- View the results on the map.
Learn more about how to perform spatial analysis with the Map Viewer in the Tutorials.
ArcGIS APIs
The easiest way to programmatically execute an analysis request to the spatial analysis service
The steps to use the Python API are:
- Import an operation from the
arcgis.features.analysislibrary. - Provide your user credentials or an API key.
- Identify the input feature layer(s) and URL(s) for the analysis.
- Set the parameters and execute the analysis.
- Get the results and add them to a map.
Example
This example executes a hot spot analysis.
traffic_crashes = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Traffic_Crashes/FeatureServer/0"
fishnet = "fishnet"
results = find_hot_spots(
analysis_layer=traffic_crashes,
shape_type=fishnet,
# Outputs results as a hosted feature layer.
output_name="Hot spot analysis results",
)
result_features = results.layers[0].query()
print(f"The hot spot layer has {len(result_features.features)} new records")
ArcGIS REST API
To access the spatial analysis serviceself request and then extracting the URL from helper. Once you have the URL you can execute a job request to perform the analysis.
The steps to access the service are:
- Get the spatial analysis service URL from your organization.
- Submit a job request to the service with the operation and parameters.
- Check the status to see when the job is complete.
- Get the results.
Example
This example shows how to execute a job request to perform a hot spot analysis.
Request
POST arcgis.com/sharing/rest/portals/self HTTP/1.1
Content-Type: application/x-www-form-urlencoded
&f=json
&token=<ACCESS_TOKEN>Response (JSON)
{
"helperServices": {
// Other parameters
"analysis": {
"url": "https://{YOUR_ANALYSIS_SERVICE}/arcgis/rest/services/tasks/GPServer"
}
}
}
{
"helperServices":{
// Other parameters
"analysis": {
"url": "https://{YOUR_ANALYSIS_SERVICE}/{WEBADAPTOR_NAME}/rest/services/System/SpatialAnalysisTools/GPServer"},
}
}4. Display the results
After you perform an analysis, the most common step is to display the results in a map. The spatial analysis service returns styling information with the resulting hosted feature layer and feature collection (JSON), so client applications and APIs can easily display the results in a map.
Visualize the layer
If you are using the Map Viewer or ArcGIS Pro, the resulting hosted feature layer is automatically added to the map when an analysis is complete. A renderer is also automatically applied from the styling information so you can visualize the results.
If you are using ArcGIS APIs, most APIs will access the styling information automatically in the resulting hosted feature layer to draw the feature layer in a map. The APIs access the styling information stored in the Drawing Info field of the feature layer.
If you own the resulting feature layer from analyses, you can use the item page
To learn more about visualizing data, go to Visualization.
Access the hosted feature layer
The easiest way to display the results of an analysis is to get the URL for the hosted feature layer that is returned and then use the URL to add the layer to the map. ArcGIS applications and APIs will use the URL to access the feature data and drawing information to render the layer in the map.
To learn more about accessing feature layers, go to Data hosting.
The steps to display the layer are:
- Sign in to your portal
ArcGIS portal, also known as a portal, is a website with applications and tools that can be used to create, manage, access, and share geospatial content and data. It supports security and authentication, developer credentials, content and data service management, user and group management, and site administration. A portal can be hosted in Esri's infrastructure or your own infrastructure. . - Find the resulting hosted feature layer that was created from your analysis.
- Get the URL.
- Add the layer to an application using an API.
Example
This example displays the results of a hot spot analysis on traffic data by accessing the hosted feature layer URL. The feature colors and symbols are rendered using the information stored in the Drawing Info field in the layer. To get the hosted feature layer URL and drawing information, go to the item page
This example uses the following:
- Item page:
- Title: Traffic_Crashes_Resulting_in_Injury_Hot_Spots
- URL:
https://www.arcgis.com/home/item.html?id=40935975462a410ca0ae20b9ee35f053
- Feature layer URL and drawing info:
- URL:
https://services3.arcgis.com/ G Vgb Jbqm8h XASV Yi/arcgis/rest/services/ Traffic _Crashes _Resulting _in _Injury _Hot _Spots/ Feature Server/0
- URL:
const analysisResultsLayer = new FeatureLayer({
url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Traffic_Crashes_Resulting_in_Injury_Hot_Spots/FeatureServer/0",
});
const map = new Map({
basemap: "arcgis/light-gray",
layers: [analysisResultsLayer],
});
const view = new MapView({
container: "viewDiv",
map: map,
center: [-122.44, 37.775],
zoom: 12,
constraints: {
snapToZoom: false,
},
});