What is a nearby analysis?
A nearby analysis is the process of finding features within a specified distance of other feature data. To execute the analysis, use the spatial analysis service and the Summarize
operation.
The distance measure can be a straight line or defined by a trave mode. Feature geometry and attribute statistics are also generated.
Use the Summarize nearby operation to calculate statistics on point, polyline, or polygon features within close proximity of another hosted feature layer.
For example, using Summarize nearby, you could:
- Calculate the total population within five minutes of driving time of a proposed new store location.
- Calculate the number of freeway access ramps within a one-mile driving distance of a proposed new store location to use as a measure of store accessibility.
- Calculate school walk zones.
There are limits to the number of features and distance when near
is set to a travel mode other than "StraightLine".
sum
- Maximum 1,000 featuresNearby Layer distance
- Maximum 300 minutes or 482.80 kilometers (300 miles)- An error will occur if the operation takes more than 60 minutes to execute when using travel modes. If this error occurs, try rerunning the analysis with fewer input features.
How to perform a nearby analysis
The general steps to performing a summarize nearby analysis are as follows:
- Review the parameters for the
Summarize
operation.Nearby - 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/ Summarize Nearby/submit Job - Parameters:
sum
: The feature data from which distances will be measured to features in theNearby Layer summary
.Layer summary
: Feature data that are within the specified distance to features in theLayer sum
.Nearby Layer output
: The name of the resulting feature layer.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
http://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer/SummarizeNearby/submitJob
Required parameters
Name | Description | Examples |
---|---|---|
f | The format of the data returned | f=json f=pjson |
token | An OAuth 2.0 access token. | token= |
sum | Point, line, or polygon features from which distances will be measured to features in the summary . | {"url" {"layer |
summary | Point, line, or polygon features. Features in this layer that are within the specified distance to features in the sum will be summarized. | {"url" {"layer |
Key parameters
Name | Description | Examples |
---|---|---|
near | Defines what type of distance measurement you want to use: straight-line distance, or by measuring travel time or travel distance along a street network using various modes of transportation known as travel modes. The default is Straight . For details about supported travel modes see the GetTravelModes operation from the Utilities service. | "near |
distances | A list of double values that defines the search distance (for StraightLine and distance-based travel modes) or time (for time-based travel modes). You can enter a single distance value or multiple values, separating each value with a space. Features that are within (or equal to) the distances you enter will be summarized. The units of the distance values are supplied by the units parameter. | "distances" |
units | If near is Straight or a distance-based travel mode, this is the linear unit to be used with the distance values specified in distances. If near is a time-based travel mode, then units are time based | "units": "Miles" "Units": "Minutes" |
return | If true, the resultLayer will contain areas defined by the specified near . For example, if using a Straight value of 5 miles, the resultLayer will contain areas with a 5-mile radius around the input sum features. | `true |
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 |
Privileges
Example
Find cafes near parks
In this example, Summarize nearby is used to find parks that have cafes that are within 300 ft.
In this analysis, the sum
value is a hosted feature layer of parks polygons. The summary
value is a hosted feature layer of Sidewalk cafes points. The near
parameter is set to Straight
with distance and units equal to 300 Feet.
APIs
nearLayer = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/obdb/FeatureServer/0"
summaryLayer = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Enriched_Portland_Neighborhoods/FeatureServer/0"
results = summarize_nearby(
summary_layer=summaryLayer,
sum_nearby_layer=nearLayer,
near_type="StraightLine",
distances=[0.25],
units="Miles",
return_boundaries=False,
minorityMajority=True,
percent_shape=True,
group_by_field="brewery_type",
#Outputs results as a hosted feature layer.
output_name="Summarize nearby results"
)
print(f"summarize result item created {results.itemid}")
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"
}
}
}