The spatial analysis service contains a number of tasks that allow you to perform common spatial analyses on your hosted data. An overview of the available tasks can be found in Overview of tasks contained in the Spatial Analysis service. These tasks are available as tools in Map Viewer Classic and ArcGIS API for Python. These tasks allow you to perform analysis against hosted layers as well as other layers they have access to.
To learn more about accessing these tasks using Map Viewer Classic, see the Perform analysis help topic or ArcGIS API for Python documentation. Note that in some cases, the Spatial Analysis REST API has more functionality that is not exposed in Map Viewer Classic or ArcGIS API for Python.
Using these tools in ArcGIS Online Map Viewer Classic consumes credits. For more information on credits, see Service credits overview.
You can programmatically access the Spatial Analysis service in the following ways:
- Use ArcGIS API for Python—This is the recommended way to access the services using Python.
- Access the REST endpoints through Python—Programmatically accessing analysis services shows you how to access these services using Python. This is recommended to access capabilities that aren't exposed in ArcGIS API for Python.
- Access the service using JavaScript—See the ArcGIS API for JavaScript topic Working with Analysis Widgets.
If you want to learn more about each tool, in addition to the information provided in the ArcGIS REST API documentation, see Perform analysis.
Licensing
To use the analysis tasks, the administrator of your organization needs to grant you certain privileges. To use any of the analysis tools, you will need the Spatial Analysis privilege. If the output of your task is a hosted feature service, as opposed to a feature collection, you also need the two following privileges:
- Create, update, and delete content
- Publish hosted features
These privileges are available with a Creator or GIS Professional user type and a Publisher, Facilitator, or Administrator role. If you do not have these privileges, you will not see the Spatial Analysis toolbox.
Certain tasks need additional privileges such as Network Analysis and GeoEnrichment. If the task requires additional privileges, they will be listed in the task documentation.
Common patterns
The tasks in the Spatial Analysis service all share the following common pattern:
- One or more of their input parameters are features. These features can come from a feature service, map service, or in the form of a feature collection. See Feature input for more information.
- As described in Feature output, all the spatial analysis tasks create new data. How data is returned to you is controlled by the outputName parameter.
- All tasks have a context parameter which controls certain aspects of task execution. context has two properties: extent and output spatial reference.
- All tasks execute asynchronously. That is, when you submit a request, you are handed back a job identifier which you can use to track progress and retrieve results. See Checking job status for more information.