What is a derive new locations analysis?
A derive new location analysis is the process of selecting and, potentially, modifying features that satisfy one or more SQL and/or spatial expressions. To execute the analysis, use the spatial analysis service and the Derive
operation.
A derive new location analysis is similar to the Find location analysis. For example, if you perform a SQL query using where
, or the spatial expressions completely within
or completey contains
, the results between the two analyses will be the same. However, if you use a derive analysis with a spatial expression such as intersects
or within a distance of
, the results can contain features with new geometries. This analysis is often used for site selection.
Real-world examples of this analysis include the following:
- Determining the portions of areas that are suitable for wildlife habitats.
- Evaluating the suitability for real estate developments for site selection.
- Finding areas closest to places of interest (POIs).
How to derive new locations
The general steps to performing a derive new locations analysis are as follows:
- Review the parameters for the
Derive
operation.New Locations - Determine if you would like the results as a feature collection (dynamic) or hosted feature layer (stored).
- Send a request to get the spatial analysis service URL.
- Execute a job request with the following URL and parameters:
- URL:
https
:// <YOUR _ANALYSIS _SERVICE >/arcgis/rest/services/tasks/ GP Server/ Derive New Locations/submit Job - Parameters:
expressions
: The SQL or spatial relation to select a subset of the data.input
: The feature collection(s) or hosted feature layer(s) from which you want to extract features.Layers output
: A string representing the name of the hosted feature layer to return with the results.Name
- URL:
- Check the status.
- Get the output layer results.
To see examples using ArcGIS API for Python, ArcGIS REST JS, and the ArcGIS REST API, go to Examples below.
URL request
https://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer/DeriveNewLocations/submitJob?<parameters>
Required parameters
Name | Description | Examples |
---|---|---|
f | The format of the data returned. | f=json f=pjson |
token | An OAuth 2.0 access token. | token= |
input | The layer(s) that will be used to construct the query. | [{"url" |
expressions | The SQL or spatial query. | [{"operator" |
Key parameters
Name | Description | Examples |
---|---|---|
output | A string representing the name of the hosted feature layer to return with the results. NOTE: If you do not include this parameter, the results are returned as a feature collection (JSON). | {"service |
context | A bounding box or output spatial reference for the analysis. | "extent" |
Code examples
Find neighborhoods sections near police stations
This example uses the Derive
operation to construct a spatial query to return the sections of San Francisco Neighborhoods that are within half a mile from a police station. While the results of the analysis return partial features that match the spatial query, the new features still contain the attribute information from the originally hosted feature layer.
For the analysis, the input
value is the Police stations and neighborhoods hosted feature layers. The expression
value used is: S
.
APIs
police_stations = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Police_Stations/FeatureServer/0"
neighborhoods = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/SF_Neighborhoods/FeatureServer/0"
results = derive_new_locations(
input_layers=[neighborhoods, police_stations],
expressions=[
{
"operator": "",
"layer": 0,
"selectingLayer": 1,
"spatialRel": "withinDistance",
"distance": 0.25,
"units": "Miles",
}
],
# Ouputs results as a hosted feature service.
output_name = "Derive analysis results"
)
result_features = results.layers[0].query()
Service requests
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"
},
"geoenrichment": {
"url": "https://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer"
}
}
}
Find light rail lines that intersect neighborhoods
This example uses the Derive
operation to construct a spatial query that returns only the sections of light rail lines that intersect Downtown Portland.
For the analysis, the input
are the Light rail lines and Portland neighborhoods hosted feature layers. The expression
used is: Light rail lines intersects Portland neighborhoods
.
APIs
rail_lines = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Light Rail Lines/FeatureServer/0"
neighborhoods = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Enriched_Portland_Neighborhoods/FeatureServer/0"
results = derive_new_locations(
input_layers=[neighborhoods, rail_lines],
expressions=[
{
"operator": "",
"layer": 0,
"selectingLayer": 1,
"spatialRel": "intersects"
}
],
# Ouputs results as a hosted feature service.
output_name = "Derive analysis results"
)
result_features = results.layers[0].query()
Service requests
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"
},
"geoenrichment": {
"url": "https://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer"
}
}
}