arcgis.features.analysis module¶
Feature Input
- All standard spatial analysis tools accept features as input. Features can be specified in one of the following ways:
Item (of type Feature Layer Collection or Feature Collection) - only the first feature layer is used
Instance of FeatureLayer, FeatureLayerCollection, FeatureCollection,
Feature Service URL as a string,
Python dict in the feature collection format
- For point feature layers, the following inputs may additonally be used for convenience:
(lat, long) pair for point feature layer
dict with ‘location’ as key (eg result from geocoding)
All the spatial analysis tools from the analyze_patterns, enrich_data, find_locations, manage_data, summarize_data and use_proximity submodules, in one place for convenience.
aggregate_points¶
-
analysis.
aggregate_points
(polygon_layer, keep_boundaries_with_no_points=True, summary_fields=[], group_by_field=None, minority_majority=False, percent_points=False, output_name=None, context=None, gis=None, estimate=False)¶ The Aggregate Points task works with a layer of point features and a layer of polygon features. It first figures out which points fall within each polygon’s area. After determining this point-in-polygon spatial relationship, statistics about all points in the polygon are calculated and assigned to the area. The most basic statistic is the count of the number of points within the polygon, but you can get other statistics as well. For example, if your points represented coffee shops and each point has a TOTAL_SALES attribute, you can get statistics like the sum of all TOTAL_SALES within the polygon, or the minimum or maximum TOTAL_SALES value, or the standard deviation of all sales within the polygon.
Parameter
Description
point_layer
Required point layer. The point features that will be aggregated into the polygons in the polygon_layer. See Feature Input.
polygon_layer
Required polygon layer. The polygon features (areas) into which the input points will be aggregated. See Feature Input.
keep_boundaries_with_no_points
Optional boolean. A Boolean value that specifies whether the polygons that have no points within them should be returned in the output. The default is true.
summary_fields
Optional list of strings. A list of field names and statistical summary type that you wish to calculate for all points within each polygon. Note that the count of points within each polygon is always returned. summary type is one of the following:
Sum—Adds the total value of all the points in each polygon
Mean—Calculates the average of all the points in each polygon.
Min—Finds the smallest value of all the points in each polygon.
Max—Finds the largest value of all the points in each polygon.
Stddev—Finds the standard deviation of all the points in each polygon.
Example [fieldName1 summaryType1,fieldName2 summaryType2].
group_by_field
Optional string. A field name in the point_layer. Points that have the same value for the group by field will have their own counts and summary field statistics. You can create statistical groups using an attribute in the analysis layer. For example, if you are aggregating crimes to neighborhood boundaries, you may have an attribute Crime_type with five different crime types. Each unique crime type forms a group, and the statistics you choose will be calculated for each unique value of Crime_type. When you choose a grouping attribute, two results are created: the result layer and a related table containing the statistics.
minority_majority
Optional boolean. This boolean parameter is applicable only when a group_by_field is specified. If true, the minority (least dominant) or the majority (most dominant) attribute values for each group field within each boundary are calculated. Two new fields are added to the aggregated_layer prefixed with Majority_ and Minority_. The default is false.
percent_points
Optional boolean. This boolean parameter is applicable only when a group_by_field is specified. If set to true, the percentage count of points for each unique group_by_field value is calculated. A new field is added to the group summary output table containing the percentages of each attribute value within each group. If minority_majority is true, two additional fields are added to the aggregated_layer containing the percentages of the minority and majority attribute values within each group.
output_name
Optional string. Output Features Name (str). Optional parameter.
context
Optional string. Context contains additional settings that affect task execution. For Aggregate Points, there are two settings.
Extent (extent)-a bounding box that defines the analysis area. Only those points in the input pointLayer that intersect the bounding box will be analyzed.
Output Spatial Reference (outSR)—the output features will be projected into the output spatial reference.
gis
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
estimate
Optional Boolean. If True, the number of credits to run the operation will be returned.
- Returns
result_layer : feature layer Item if output_name is specified, else Feature Collection.
USAGE EXAMPLE: To find number of permits issued in each zip code of US. agg_result = aggregate_points(point_layer=permits, polygon_layer=zip_codes, keep_boundaries_with_no_points=False, summary_fields=["DeclValNu mean","DeclValNu2 mean"], group_by_field='Declared_V', minority_majority=True, percent_points=True, output_name="aggregated_permits", context='{"extent":{"xmin":-8609738.077325115,"ymin":4743483.445485223,"xmax":-8594030.268012533,"ymax":4752206.821338257,"spatialReference":{"wkid":102100,"latestWkid":3857}}}')
calculate_density¶
-
analysis.
calculate_density
(field=None, cell_size=None, cell_size_units='Meters', radius=None, radius_units=None, bounding_polygon_layer=None, area_units=None, classification_type='EqualInterval', num_classes=10, output_name=None, context=None, gis=None, estimate=False)¶ The calculate_density function creates a density map from point or line features by spreading known quantities of some phenomenon (represented as attributes of the points or lines) across the map. The result is a layer of areas classified from least dense to most dense.
For point input, each point should represent the location of some event or incident, and the result layer represents a count of the incident per unit area. A higher density value in a new location means that there are more points near that location. In many cases, the result layer can be interpreted as a risk surface for future events. For example, if the input points represent locations of lightning strikes, the result layer can be interpreted as a risk surface for future lightning strikes.
For line input, the line density surface represents the total amount of line that is near each location. The units of the calculated density values are the length of line per unit area. For example, if the lines represent rivers, the result layer will represent the total length of rivers that are within the search radius. This result can be used to identify areas that are hospitable to grazing animals.
Argument
Description
input_layer
Required layer. The point or line features from which to calculate density. See Feature Input.
field
Optional string. A numeric field name specifying the number of incidents at each location. For example, if you have points that represent cities, you can use a field representing the population of the city as the count field, and the resulting population density layer will calculate larger population densities near cities with larger populations. If not specified, each location will be assumed to represent a single count.
cell_size
Optional float. This value is used to create a mesh of points where density values are calculated. The default is approximately 1/1000th of the smaller of the width and height of the analysis extent as defined in the context parameter. The smaller the value, the smoother the polygon boundaries will be. Conversely, with larger values, the polygon boundaries will be more coarse and jagged.
cell_size_units
Optional string. The units of the cell_size value. Choice list: [‘Miles’, ‘Feet’, ‘Kilometers’, ‘Meters’]
radius
Optional float. A distance specifying how far to search to find point or line features when calculating density values.
radius_units
Optional string. The units of the radius parameter. If no distance is provided, a default will be calculated that is based on the locations of the input features and the values in the count field (if a count field is provided). Choice list: [‘Miles’, ‘Feet’, ‘Kilometers’, ‘Meters’]
bounding_polygon_layer
Optional layer. A layer specifying the polygon(s) where you want densities to be calculated. For example, if you are interpolating densities of fish within a lake, you can use the boundary of the lake in this parameter and the output will only draw within the boundary of the lake. See Feature Input.
area_units
Optional string. The units of the calculated density values. Choice list: [‘areaUnits’, ‘SquareMiles’]
classification_type
Optional string. Determines how density values will be classified into polygons. Choice list: [‘EqualInterval’, ‘GeometricInterval’, ‘NaturalBreaks’, ‘EqualArea’, ‘StandardDeviation’]
EqualInterval—Polygons are created such that the range of density values is equal for each area.
GeometricInterval—Polygons are based on class intervals that have a geometric series. This method ensures that each class range has approximately the same number of values within each class and that the change between intervals is consistent.
NaturalBreaks—Class intervals for polygons are based on natural groupings of the data. Class break values are identified that best group similar values and that maximize the differences between classes.
EqualArea—Polygons are created such that the size of each area is equal. For example, if the result has more high density values than low density values, more polygons will be created for high densities.
StandardDeviation—Polygons are created based upon the standard deviation of the predicted density values.
num_classes
Optional int. This value is used to divide the range of predicted values into distinct classes. The range of values in each class is determined by the classification_type parameter.
output_name
Optional string. Additional properties such as output feature service name.
context
Optional string. Additional settings such as processing extent and output spatial reference. For calculate_density, there are two settings.
Extent (extent)-a bounding box that defines the analysis area. Only those points in the input_layer that intersect the bounding box will be analyzed.
Output Spatial Reference (outSR)—the output features will be projected into the output spatial reference.
gis
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
estimate
Optional Boolean. Is true, the number of credits needed to run the operation will be returned as a float.
- Returns
result_layer : feature layer Item if output_name is specified, else Feature Collection.
USAGE EXAMPLE: To create a layer that shows density of collisions within 2 miles. The density is classified based upon the standard deviation. The range of density values is divided into 5 classes. collision_density = calculate_density(input_layer=collisions, radius=2, radius_units='Miles', bounding_polygon_layer=zoning_lyr, area_units='SquareMiles', classification_type='StandardDeviation', num_classes=5, output_name='density_of_incidents')
connect_origins_to_destinations¶
-
analysis.
connect_origins_to_destinations
(destinations_layer, measurement_type='DrivingTime', origins_layer_route_id_field=None, destinations_layer_route_id_field=None, time_of_day=None, time_zone_for_time_of_day='GeoLocal', output_name=None, context=None, gis=None, estimate=False, point_barrier_layer=None, line_barrier_layer=None, polygon_barrier_layer=None)¶ The Connect Origins to Destinations task measures the travel time or distance between pairs of points. Using this tool, you can
Calculate the total distance or time commuters travel on their home-to-work trips.
Measure how far customers are traveling to shop at your stores. Use this information to define your market reach, especially when targeting advertising campaigns or choosing new store locations.
Calculate the expected trip mileage for your fleet of vehicles. Afterward, run the Summarize Within tool to report mileage by state or other region.
You provide starting and ending points, and the tool returns a layer containing route lines, including measurements, between the paired origins and destinations.
Argument
Description
origins_layer
Required layer. The starting point or points of the routes to be generated. See Feature Input.
destinations_layer
Required layer. The routes end at points in the destinations layer. See Feature Input.
measurement_type
Required string. The origins and destinations can be connected by measuring straight-line distance, or by measuring travel time or travel distance along a street network using various modes of transportation known as travel modes.
Valid values are a string, StraightLine, which indicates Euclidean distance to be used as distance measure or a Python dictionary representing settings for a travel mode.
When using a travel mode for the measurement_type, you need to specify a dictionary containing the settings for a travel mode supported by your organization. The code in the example section below generates a valid Python dictionary and then passes it as the value for the measurement_type parameter.
Supported travel modes: [‘Driving Distance’, ‘Driving Time’, ‘Rural Driving Distance’, ‘Rural Driving Time’, ‘Trucking Distance’, ‘Trucking Time’, ‘Walking Distance’, ‘Walking Time’]
origins_layer_route_id_field
Optional string. Specify the field in the origins layer containing the IDs that pair origins with destinations.
The ID values must uniquely identify points in the origins layer.
Each ID value must also correspond with exactly one route ID value in the destinations layer. Route IDs that match across the layers create origin-destination pairs, which the tool connects together.
Specifying origins_layer_route_id_field is optional when there is exactly one point feature in the origins or destinations layer. The tool will connect all origins to the one destination or the one origin to all destinations, depending on which layer contains one point.
destinations_layer_route_id_field
Optional string. Specify the field in the destinations layer containing the IDs that pair origins with destinations.
The ID values must uniquely identify points in the destinations layer.
Each ID value must also correspond with exactly one route ID value in the origins layer. Route IDs that match across the layers create origin-destination pairs, which the tool connects together.
Specifying destinations_layer_route_id_field is optional when there is exactly one point feature in the origins or destinations layer. The tool will connect all origins to the one destination or the one origin to all destinations, depending on which layer contains one point.
time_of_day
Optional datetime.datetime. Specify whether travel times should consider traffic conditions. To use traffic in the analysis, set measurement_type to a travel mode object whose impedance_attribute_name property is set to travel_time and assign a value to time_of_day. (A travel mode with other impedance_attribute_name values don’t support traffic.) The time_of_day value represents the time at which travel begins, or departs, from the origin points. The time is specified as datetime.datetime.
The service supports two kinds of traffic: typical and live. Typical traffic references travel speeds that are made up of historical averages for each five-minute interval spanning a week. Live traffic retrieves speeds from a traffic feed that processes phone probe records, sensors, and other data sources to record actual travel speeds and predict speeds for the near future.
The data coverage page shows the countries Esri currently provides traffic data for.
Typical Traffic:
To ensure the task uses typical traffic in locations where it is available, choose a time and day of the week, and then convert the day of the week to one of the following dates from 1990:
Monday—1/1/1990
Tuesday—1/2/1990
Wednesday—1/3/1990
Thursday—1/4/1990
Friday—1/5/1990
Saturday—1/6/1990
Sunday—1/7/1990
Set the time and date as datetime.datetime.
For example, to solve for 1:03 p.m. on Thursdays, set the time and date to 1:03 p.m., 4 January 1990; and convert to datetime eg. datetime.datetime(1990, 1, 4, 1, 3).
Live Traffic:
To use live traffic when and where it is available, choose a time and date and convert to datetime.
Esri saves live traffic data for 12 hours and references predictive data extending 12 hours into the future. If the time and date you specify for this parameter is outside the 24-hour time window, or the travel time in the analysis continues past the predictive data window, the task falls back to typical traffic speeds.
Examples: from datetime import datetime
“time_of_day”: datetime(1990, 1, 4, 1, 3) # 13:03, 4 January 1990. Typical traffic on Thursdays at 1:03 p.m.
“time_of_day”: datetime(1990, 1, 7, 17, 0) # 17:00, 7 January 1990. Typical traffic on Sundays at 5:00 p.m.
“time_of_day”: datetime(2014, 10, 22, 8, 0) # 8:00, 22 October 2014. If the current time is between 8:00 p.m., 21 Oct. 2014 and 8:00 p.m., 22 Oct. 2014, live traffic speeds are referenced in the analysis; otherwise, typical traffic speeds are referenced.
“time_of_day”: datetime(2015, 3, 18, 10, 20) # 10:20, 18 March 2015. If the current time is between 10:20 p.m., 17 Mar. 2015 and 10:20 p.m., 18 Mar. 2015, live traffic speeds are referenced in the analysis; otherwise, typical traffic speeds are referenced.
time_zone_for_time_of_day
Optional string. Specify the time zone or zones of the timeOfDay parameter. Choice list: [‘GeoLocal’, ‘UTC’]
GeoLocal-refers to the time zone in which the originsLayer points are located.
UTC-refers to Coordinated Universal Time.
include_route_layers
Optional Boolean. When include_route_layers is set to true, each route from the result is also saved as a route layer item. A route layer includes all the information for a particular route such as the stops assigned to the route as well as the travel directions. Creating route layers is useful if you want to share individual routes with other members in your organization. The route layers use the output feature service name provided in the outputName parameter as a prefix and the route name generated as part of the analysis is added to create a unique name for each route layer.
Caution: Route layers cannot be created when the output is a feature collection. The task will raise an error if output_name is not specified (which indicates feature collection output) and include_route_layers is true.
The maximum number of route layers that can be created is 1,000. If the result contains more than 1,000 routes and include_route_layers is true, the task will only create the output feature service.
output_name
Optional string. If provided, the task will create a feature layer of the results. You define the name of the layer. If output_name is not supplied, the task will return a feature collection.
context
Optional string. Additional settings such as processing extent and output spatial reference. For calculate_density, there are two settings.
Extent (extent)-a bounding box that defines the analysis area. Only those points in the origins_layer and destinations_layer that intersect the bounding box will be analyzed.
Output Spatial Reference (outSR)
If the output is a feature service, the spatial reference will be the same as originsLayer. Setting outSR for feature services has no effect.
If the output is a feature collection, the features will be in the spatial reference of the outSRvalue or the spatial reference of originsLayer when outSR is not specified.
gis
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
estimate
Optional Boolean. Is true, the number of credits needed to run the operation will be returned as a float.
point_barrier_layer
Optional layer. Specify one or more point features that act as temporary restrictions (in other words, barriers) when traveling on the underlying streets.
A point barrier can model a fallen tree, an accident, a downed electrical line, or anything that completely blocks traffic at a specific position along the street. Travel is permitted on the street but not through the barrier. See Feature Input.
line_barrier_layer
Optional layer. Specify one or more line features that prohibit travel anywhere the lines intersect the streets.
A line barrier prohibits travel anywhere the barrier intersects the streets. For example, a parade or protest that blocks traffic across several street segments can be modeled with a line barrier. See Feature Input.
polygon_barrier_layer
Optional string. Specify one or more polygon features that completely restrict travel on the streets intersected by the polygons.
One use of this type of barrier is to model floods covering areas of the street network and making road travel there impossible. See Feature Input.
- Returns
dict with the following keys:
”routes_layer” : layer (FeatureCollection)
”unassigned_origins_layer” : layer (FeatureCollection)
”unassigned_destinations_layer” : layer (FeatureCollection)
USAGE EXAMPLE: To retrieve trvel modes and run connect_origins_to_destinations tool. This example creates route between esri regional offices to esri headquarter. import arcgis.network as network route_service = network.RouteLayer(gis.properties.helperServices.route.url, gis=gis) travel_mode = [i for i in route_service.retrieve_travel_modes()['supportedTravelModes'] if i['name'] == 'Rural Driving Distance'][0] routes = connect_origins_to_destinations(origins_layer=esri_regional, destinations_layer=dest_layer, measurement_type=travel_mode, time_of_day=datetime(1990, 1, 4, 1, 3), output_name="routes_from_offices_to_hq")
create_buffers¶
-
analysis.
create_buffers
(distances=[], field=None, units='Meters', dissolve_type='None', ring_type='Disks', side_type='Full', end_type='Round', output_name=None, context=None, gis=None, estimate=False)¶ Creates buffer polygon(s) around input features.
- input_layerRequired layer (see Feature Input in documentation)
The input to be buffered.
- distancesOptional list of floats
The distance(s) that will be buffered.
- fieldOptional string
Buffers will be created using field values.
- unitsOptional string
The linear unit to be used with the distance value(s).
- dissolve_typeOptional string
Specifies the dissolve to be performed to remove buffer overlap.
- ring_typeOptional string
The ring type.
- side_typeOptional string
The side(s) of the input that will be buffered.
- end_typeOptional string
The shape of the buffer at the end of buffered line features.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
buffer_layer : layer (FeatureCollection)
create_drive_time_areas¶
-
analysis.
create_drive_time_areas
(break_values=[5, 10, 15], break_units='Minutes', travel_mode='Driving', overlap_policy='Overlap', time_of_day=None, time_zone_for_time_of_day='GeoLocal', output_name=None, context=None, gis=None, estimate=False)¶ input_layer : Required layer (see Feature Input in documentation)
break_values : Optional list of floats
break_units : Optional string
travel_mode : Optional string
overlap_policy : Optional string
time_of_day : Optional datetime.datetime
time_zone_for_time_of_day : Optional string
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
drive_time_areas_layer : layer (FeatureCollection)
create_route_layers¶
-
analysis.
create_route_layers
(delete_route_data_item=False, tags=None, summary=None, route_name_prefix=None, folder_name=None, gis=None, estimate=False)¶ Creates route layer items on the portal from the input route data.
- route_data_itemRequired item
The route data item that is used to create route layer items.
- delete_route_data_itemRequired Boolean (see Feature Input in documentation)
Indicates if the input route data item should be deleted. The default value is False which does not delete the route data item.
- tags: Optional string
Tags used to describe and identify the route layer items. Individual tags are separated using a comma. The route name is always added as a tag even when a value for this argument is not specified.
- summary: Optional string
The summary displayed as part of the item information for the route layer item. If a value for this argument is not specified, a default summary text “Route and directions for <Route Name>” is used.
- route_name_prefixOptional string
A qualifier added to the title of every route layer item. This can be used to designate all routes that are shared for a specific purpose to have the same prefix in the title. The name of the route is always appended after this qualifier. If a value for the route_name_prefix is not specified, the title for the route layer item is created using only the route name.
- folder_name: Optional string
The folder within your personal online workspace (My Content in your ArcGIS Online or Portal for ArcGIS organization) where the route layer items will be created. If a folder with the specified name does not exist, a new folder will be created. If a folder with the specified name exists, the items will be created in the existing folder. If a value for folder_name is not specified, the route layer items are created in the root folder of your online workspace.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
route_layers : list (items)
create_viewshed¶
-
analysis.
create_viewshed
(dem_resolution='Finest', maximum_distance=None, max_distance_units='Meters', observer_height=None, observer_height_units='Meters', target_height=None, target_height_units='Meters', generalize=True, output_name=None, context=None, gis=None, estimate=False)¶ Creates areas that are visible based on locations you specify.
input_layer : Required layer (see Feature Input in documentation)
dem_resolution : Optional string
maximum_distance : Optional float
max_distance_units : Optional string
observer_height : Optional float
observer_height_units : Optional string
target_height : Optional float
target_height_units : Optional string
generalize : Optional bool
output_name : Optional string
context : Optional string
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
viewshed_layer : layer (FeatureCollection)
create_watersheds¶
-
analysis.
create_watersheds
(search_distance=None, search_units='Meters', source_database='FINEST', generalize=True, output_name=None, context=None, gis=None, estimate=False)¶ Creates catchment areas based on locations you specify.
input_layer : Required layer (see Feature Input in documentation)
search_distance : Optional float
search_units : Optional string
source_database : Optional string
generalize : Optional bool
output_name : Optional string
context : Optional string
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
- dict with the following keys:
“snap_pour_pts_layer” : layer (FeatureCollection) “watershed_layer” : layer (FeatureCollection)
derive_new_locations¶
-
analysis.
derive_new_locations
(expressions=[], output_name=None, context=None, gis=None, estimate=False)¶ The Derive New Locations task derives new features from the input layers that meet a query you specify. A query is made up of one or more expressions. There are two types of expressions: attribute and spatial. An example of an attribute expression is that a parcel must be vacant, which is an attribute of the Parcels layer (where STATUS = ‘VACANT’). An example of a spatial expression is that the parcel must also be within a certain distance of a river (Parcels within a distance of 0.75 Miles from Rivers).The Derive New Locations task is very similar to the Find Existing Locations task, the main difference is that the result of Derive New Locations can contain partial features.In both tasks, the attribute expression where and the spatial relationships within and contains return the same result. This is because these relationships return entire features.When intersects or withinDistance is used, Derive New Locations creates new features in the result. For example, when intersecting a parcel feature and a flood zone area that partially overlap each other, Find Existing Locations will return the entire parcel whereas Derive New Locations will return just the portion of the parcel that is within the flood zone.
- input_layersRequired list of strings
A list of layers that will be used in the expressions parameter.
- expressionsRequired string
Specify a list of expressions. Please refer documentation at http://developers.arcgis.com for more information on expressions.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
result_layer : layer (FeatureCollection)
dissolve_boundaries¶
-
analysis.
dissolve_boundaries
(dissolve_fields=[], summary_fields=[], output_name=None, context=None, gis=None, estimate=False)¶ Dissolve features based on specified fields.
- input_layerRequired layer (see Feature Input in documentation)
The layer containing polygon features that will be dissolved.
- dissolve_fieldsOptional list of strings
One or more fields from the input that control which polygons are merged. If no fields are supplied, all polygons that overlap or shared a common border will be dissolved into one polygon.
- summary_fieldsOptional list of strings
A list of field names and statistical types that will be used to summarize the output. Supported statistics include: Sum, Mean, Min, Max, and Stddev.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
dissolved_layer : layer (FeatureCollection)
enrich_layer¶
-
analysis.
enrich_layer
(data_collections=[], analysis_variables=[], country=None, buffer_type=None, distance=None, units=None, output_name=None, context=None, gis=None, estimate=False)¶ The enrich_layer function enriches your data by getting facts about the people, places, and businesses that surround your data locations. For example: What kind of people live here? What do people like to do in this area? What are their habits and lifestyles? What kind of businesses are there in this area?The result will be a new layer of input features that includes all demographic and geographic information from given data collections.
- input_layerRequired layer (see Feature Input in documentation)
Feature layer to enrich with new data
- data_collectionsOptional list of strings
Data collections you wish to add to your features.
- analysis_variablesOptional list of strings
A subset of specific variables instead of dataCollections.
- countryOptional string
The two character country code that specifies the country of the input features. Eg. US (United States), FR (France), GB (United Kingdom) etc.
- buffer_typeOptional string
Area to be created around the point or line features for enrichment. Default is 1 Mile straight-line buffer radius.
- distanceOptional float
A double value that defines the straight-line distance or time (when drivingTime is used).
- unitsOptional string
The unit (eg. Miles, Minutes) to be used with the distance value(s) specified in the distance parameter to calculate the area.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
enriched_layer : layer (FeatureCollection)
extract_data¶
-
analysis.
extract_data
(extent=None, clip=False, data_format=None, output_name=None, context=None, gis=None, estimate=False)¶ Select and download data for a specified area of interest. Layers that you select will be added to a zip file or layer package.
- input_layersRequired list of strings
The layers from which you can extract features.
- extentOptional string
The area that defines which features will be included in the output zip file or layer package.
- clipOptional bool
Select features that intersect the extent or clip features within the extent.
- data_formatOptional string
Format of the data that will be extracted and downloaded. Layer packages will always include file geodatabases.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
content_id : layer (FeatureCollection)
find_existing_locations¶
-
analysis.
find_existing_locations
(expressions=None, output_name=None, context=None, gis=None, estimate=False)¶ The Find Existing Locations task selects features in the input layer that meet a query you specify. A query is made up of one or more expressions. There are two types of expressions: attribute and spatial. An example of an attribute expression is that a parcel must be vacant, which is an attribute of the Parcels layer (where STATUS = ‘VACANT’). An example of a spatial expression is that the parcel must also be within a certain distance of a river (Parcels within a distance of 0.75 Miles from Rivers).
- input_layersRequired list of strings
A list of layers that will be used in the expressions parameter.
- expressionsRequired string
Specify a list of expressions. Please refer documentation at http://developers.arcgis.com for more information on creating expressions.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
result_layer : layer (FeatureCollection)
find_hot_spots¶
-
analysis.
find_hot_spots
(analysis_field=None, divided_by_field=None, bounding_polygon_layer=None, aggregation_polygon_layer=None, output_name=None, context=None, gis=None, estimate=False, shape_type=None)¶ The Find Hot Spots function finds statistically significant clusters of incident points, weighted points, or weighted polygons. For incident data, the analysis field (weight) is obtained by aggregation. Output is a hot spot map.
Argument
Description
analysis_layer
Required layer (see Feature Input in documentation). The point or polygon feature layer for which hot spots will be calculated.
analysis_field
Optional string. The numeric field in the AnalysisLayer that will be analyzed.
divided_by_field
Optional string. The field that will segment the locations.
bounding_polygon_layer
Optional layer (see Feature Input in documentation). When the analysis layer is points and no AnalysisField is specified, you can provide polygons features that define where incidents could have occurred.
aggregation_polygon_layer
Optional layer (see Feature Input in documentation). When the AnalysisLayer contains points and no AnalysisField is specified, you can provide polygon features into which the points will be aggregated and analyzed, such as administrative units.
output_name
Optional string. Additional properties such as output feature service name.
context
Optional string. Additional settings such as processing extent and output spatial reference.
gis
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
estimate
Optional Boolean. Is true, the number of credits needed to run the operation will be returned as a float.
shape_type
Optional string. The shape of the polygon mesh the input features will be aggregated into.
- Returns
dict with the following keys: “hot_spots_result_layer” : layer (FeatureCollection) “process_info” : list of messages
find_nearest¶
-
analysis.
find_nearest
(near_layer, measurement_type='StraightLine', max_count=100, search_cutoff=2147483647, search_cutoff_units=None, time_of_day=None, time_zone_for_time_of_day='GeoLocal', output_name=None, context=None, gis=None, estimate=False)¶ Measures the straight-line distance, driving distance, or driving time from features in the analysis layer to features in the near layer, and copies the nearest features in the near layer to a new layer. Returns a layer containing the nearest features and a line layer that links the start locations to their nearest locations.
- analysis_layerRequired layer (see Feature Input in documentation)
For each feature in this layer, the task finds the nearest features from the nearLayer.
- near_layerRequired layer (see Feature Input in documentation)
The features from which the nearest locations are found.
- measurement_typeRequired string
The nearest locations can be determined by measuring straight-line distance, driving distance, or driving time
- max_countOptional int
The maximum number of near locations to find for each feature in analysisLayer.
- search_cutoffOptional float
Limits the search range to this value
- search_cutoff_unitsOptional string
The units for the value specified as searchCutoff
- time_of_dayOptional datetime.datetime
When measurementType is DrivingTime, this value specifies the time of day to be used for driving time calculations based on traffic.
time_zone_for_time_of_day : Optional string
- output_nameOptional string
Additional properties such as output feature service name
- contextOptional string
Additional settings such as processing extent and output spatial reference
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
- dict with the following keys:
“nearest_layer” : layer (FeatureCollection) “connecting_lines_layer” : layer (FeatureCollection)
find_point_clusters¶
-
analysis.
find_point_clusters
(min_features_cluster, search_distance=None, search_distance_unit=None, output_name=None, context=None, gis=None, estimate=False)¶ The Find Point Clusters function finds clusters of point features in surrounding noise based on their spatial distribution. Output is a layer containing records assigned to a cluster or noise.
Argument
Description
analysis_layer
Required layer. The point feature layer for which density-based clustering will be calculated.
min_features_cluster
Required integer. The minimum number of features to be considered a cluster. Any cluster with fewer features than the number provided will be considered noise.
search_distance
Optional double. The maximum distance to consider. The Minimum Features per Cluster specified must be found within this distance for cluster membership. Individual clusters will be separated by at least this distance. If a feature is located further than this distance from the next closest feature in the cluster, it will not be included in the cluster.
search_distance_unit
Optional string. The linear unit to be used for the search distance parameter.
output_name
Optional string. Additional properties such as output feature service name.
context
Optional string. Additional settings such as processing extent and output spatial reference.
gis
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
estimate
Optional Boolean. If True, the number of credits to run the operation will be returned.
- Returns
Python dictionary with the following keys: “point_clusters_result_layer” : layer (FeatureCollection) “process_info” : list of messages
find_similar_locations¶
-
analysis.
find_similar_locations
(search_layer, analysis_fields=[], input_query=None, number_of_results=0, output_name=None, context=None, gis=None, estimate=False)¶ Finds the locations that are most similar to one or more reference locations based on criteria that you specify.
input_layer : Required layer (see Feature Input in documentation)
search_layer : Required layer (see Feature Input in documentation)
analysis_fields : Required list of strings
input_query : Optional string
number_of_results : Optional int
output_name : Optional string
context : Optional string
- dict with the following keys:
“similar_result_layer” : layer (FeatureCollection) “process_info” : layer (FeatureCollection)
interpolate_points¶
-
analysis.
interpolate_points
(field, interpolate_option='5', output_prediction_error=False, classification_type='GeometricInterval', num_classes=10, class_breaks=[], bounding_polygon_layer=None, predict_at_point_layer=None, output_name=None, context=None, gis=None, estimate=False)¶ The Interpolate Points function allows you to predict values at new locations based on measurements from a collection of points. The function takes point data with values at each point and returns areas classified by predicted values.
- input_layerRequired layer (see Feature Input in documentation)
The point layer whose features will be interpolated.
- fieldRequired string
Name of the numeric field containing the values you wish to interpolate.
- interpolate_optionOptional string
Integer value declaring your preference for speed versus accuracy, from 1 (fastest) to 9 (most accurate). More accurate predictions take longer to calculate.
- output_prediction_errorOptional bool
If True, a polygon layer of standard errors for the interpolation predictions will be returned in the predictionError output parameter.
- classification_typeOptional string
Determines how predicted values will be classified into areas.
- num_classesOptional int
This value is used to divide the range of interpolated values into distinct classes. The range of values in each class is determined by the classificationType parameter. Each class defines the boundaries of the result polygons.
- class_breaksOptional list of floats
If classificationType is Manual, supply desired class break values separated by spaces. These values define the upper limit of each class, so the number of classes will equal the number of entered values. Areas will not be created for any locations with predicted values above the largest entered break value. You must enter at least two values and no more than 32.
- bounding_polygon_layerOptional layer (see Feature Input in documentation)
A layer specifying the polygon(s) where you want values to be interpolated.
- predict_at_point_layerOptional layer (see Feature Input in documentation)
An optional layer specifying point locations to calculate prediction values. This allows you to make predictions at specific locations of interest.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
- dict with the following keys:
“result_layer” : layer (FeatureCollection) “prediction_error” : layer (FeatureCollection) “predicted_point_layer” : layer (FeatureCollection)
join_features¶
-
analysis.
join_features
(join_layer, spatial_relationship=None, spatial_relationship_distance=None, spatial_relationship_distance_units=None, attribute_relationship=None, join_operation='JoinOneToOne', summary_fields=None, output_name=None, context=None, gis=None, estimate=False)¶ Parameters:
target_layer: targetLayer (str). Required parameter.
join_layer: joinLayer (str). Required parameter.
- spatial_relationship: spatialRelationship (str). Optional parameter.
Choice list:[‘intersects’, ‘withindistance’, ‘completelycontains’, ‘completelywithin’, ‘within’, ‘contains’, ‘identicalto’]
spatial_relationship_distance: spatialRelationshipDistance (float). Optional parameter.
- spatial_relationship_distance_units: spatialRelationshipDistanceUnits (str). Optional parameter.
Choice list:[‘Meters’, ‘Kilometers’, ‘Feet’, ‘Yards’, ‘Miles’, ‘NauticalMiles’]
attribute_relationship: attributeRelationship (str). Optional parameter.
- join_operation: joinOperation (str). Optional parameter.
Choice list:[‘JoinOneToOne’, ‘JoinOneToMany’]
summary_fields: summaryFields (str). Optional parameter.
output_name: outputName (str). Optional parameter.
context: context (str). Optional parameter.
gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
estimate: Optional Boolean. If True, the number of credits to run the operation will be returned.
- Returns:
output_layer - outputLayer as a str
See http://localhost:6080/arcgis/rest/directories/arcgisoutput/tasks_GPServer/tasks/JoinFeatures.htm for additional help.
merge_layers¶
-
analysis.
merge_layers
(merge_layer, merging_attributes=[], output_name=None, context=None, gis=None, estimate=False)¶ Combines two inputs of the same feature data type into a new output.
- input_layerRequired layer (see Feature Input in documentation)
The point, line, or polygon features to merge with the mergeLayer.
- merge_layerRequired layer (see Feature Input in documentation)
The point, line or polygon features to merge with inputLayer. mergeLayer must contain the same feature type point, line, or polygon) as the inputLayer.
- merging_attributesOptional list of strings
An array of values that describe how fields from the mergeLayer are to be modified. By default all fields from both inputs will be carried across to the output.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
merged_layer : layer (FeatureCollection)
overlay_layers¶
-
analysis.
overlay_layers
(overlay_layer, overlay_type='Intersect', snap_to_input=False, output_type='Input', tolerance=None, output_name=None, context=None, gis=None, estimate=False)¶ Overlays the input layer with the overlay layer. Overlay operations supported are Intersect, Union, and Erase.
- input_layerRequired layer (see Feature Input in documentation)
The input analysis layer.
- overlay_layerRequired layer (see Feature Input in documentation)
The layer to be overlaid with the analysis layer.
- overlay_typeOptional string
The overlay type (INTERSECT, UNION, or ERASE) defines how the analysis layer and the overlay layer are combined.
- snap_to_inputOptional bool
When the distance between features is less than the tolerance, the features in the overlay layer will snap to the features in the input layer.
- output_typeOptional string
The type of intersection (INPUT, LINE, POINT).
- toleranceOptional float
The minimum distance separating all feature coordinates (nodes and vertices) as well as the distance a coordinate can move in X or Y (or both).
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
output_layer : layer (FeatureCollection)
plan_routes¶
-
analysis.
plan_routes
(route_count, max_stops_per_route, route_start_time, start_layer, start_layer_route_id_field=None, return_to_start=True, end_layer=None, end_layer_route_id_field=None, travel_mode='Driving', stop_service_time=0, max_route_time=525600, include_route_layers=False, output_name=None, context=None, gis=None, estimate=False)¶ You provide a set of stops and the number of vehicles available to visit the stops, and Plan Routes determines how to efficiently assign the stops to the vehicles and route the vehicles to the stops.
Use this tool to plan work for a mobile team of inspectors, appraisers, in-home support service providers, and others; deliver or pick up items from remote locations; or offer transportation services to people.
stops_layer : Required layer (see Feature Input in documentation)
route_count : Required int
max_stops_per_route : Required int
route_start_time : Required datetime.datetime
start_layer : Required layer (see Feature Input in documentation)
start_layer_route_id_field : Optional string
return_to_start : Optional bool
end_layer : Optional layer (see Feature Input in documentation)
end_layer_route_id_field : Optional string
travel_mode : Optional string
stop_service_time : Optional float
max_route_time : Optional float
include_route_layers : Optional bool
output_name : Optional string
context : Optional string
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
- dict with the following keys:
“routes_layer” : layer (FeatureCollection) “assigned_stops_layer” : layer (FeatureCollection) “unassigned_stops_layer” : layer (FeatureCollection)
summarize_nearby¶
-
analysis.
summarize_nearby
(summary_layer, near_type='StraightLine', distances=[], units='Meters', time_of_day=None, time_zone_for_time_of_day='GeoLocal', return_boundaries=True, sum_shape=True, shape_units=None, summary_fields=[], group_by_field=None, minority_majority=False, percent_shape=False, output_name=None, context=None, gis=None, estimate=False)¶ The SummarizeNearby task finds features that are within a specified distance of features in the input layer. Distance can be measured as a straight-line distance, a drive-time distance (for example, within 10 minutes), or a drive distance (within 5 kilometers). Statistics are then calculated for the nearby features. For example: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.
- sum_nearby_layerRequired layer (see Feature Input in documentation)
Point, line, or polygon features from which distances will be measured to features in the summarizeLayer.
- summary_layerRequired layer (see Feature Input in documentation)
Point, line, or polygon features. Features in this layer that are within the specified distance to features in the sumNearbyLayer will be summarized.
- near_typeOptional string
Defines what kind of distance measurement you want to use to create areas around the nearbyLayer features.
- distancesRequired list of floats
An array of double values that defines the search distance for creating areas mentioned above
- unitsOptional string
The linear unit for distances parameter above. Eg. Miles, Kilometers, Minutes Seconds etc
- time_of_dayOptional datetime.datetime
For timeOfDay, set the time and day according to the number of milliseconds elapsed since the Unix epoc (January 1, 1970 UTC). When specified and if relevant for the nearType parameter, the traffic conditions during the time of the day will be considered.
- time_zone_for_time_of_dayOptional string
Determines if the value specified for timeOfDay is specified in UTC or in a time zone that is local to the location of the origins.
- return_boundariesOptional bool
If true, will return a result layer of areas that contain the requested summary information. The resulting areas are defined by the specified nearType. For example, if using a StraightLine of 5 miles, your result will contain areas with a 5 mile radius around the input features and specified summary information.If false, the resulting layer will return the same features as the input analysis layer with requested summary information.
- sum_shapeOptional bool
A boolean value that instructs the task to calculate count of points, length of lines or areas of polygons of the summaryLayer within each polygon in sumWithinLayer.
- shape_unitsOptional string
Specify units to summarize the length or areas when sumShape is set to true. Units is not required to summarize points.
- summary_fieldsOptional list of strings
A list of field names and statistical summary type that you wish to calculate for all features in the summaryLayer that are within each polygon in the sumWithinLayer . Eg: [“fieldname1 summary”, “fieldname2 summary”]
- group_by_fieldOptional string
Specify a field from the summaryLayer features to calculate statistics separately for each unique value of the field.
- minority_majorityOptional bool
This boolean parameter is applicable only when a groupByField is specified. If true, the minority (least dominant) or the majority (most dominant) attribute values within each group, within each boundary will be calculated.
- percent_shapeOptional bool
This boolean parameter is applicable only when a groupByField is specified. If set to true, the percentage of shape (eg. length for lines) for each unique groupByField value is calculated.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
- dict with the following keys:
“result_layer” : layer (FeatureCollection) “group_by_summary” : layer (FeatureCollection)
summarize_within¶
-
analysis.
summarize_within
(summary_layer, sum_shape=True, shape_units=None, summary_fields=[], group_by_field=None, minority_majority=False, percent_shape=False, output_name=None, context=None, gis=None, estimate=False)¶ The SummarizeWithin task helps you to summarize and find statistics on the point, line, or polygon features (or portions of these features) that are within the boundaries of polygons in another layer. For example:Given a layer of watershed boundaries and a layer of land-use boundaries by land-use type, calculate total acreage of land-use type for each watershed.Given a layer of parcels in a county and a layer of city boundaries, summarize the average value of vacant parcels within each city boundary.Given a layer of counties and a layer of roads, summarize the total mileage of roads by road type within each county.
- sum_within_layerRequired layer (see Feature Input in documentation)
A polygon feature layer or featurecollection. Features, or portions of features, in the summaryLayer (below) that fall within the boundaries of these polygons will be summarized.
- summary_layerRequired layer (see Feature Input in documentation)
Point, line, or polygon features that will be summarized for each polygon in the sumWithinLayer.
- sum_shapeOptional bool
A boolean value that instructs the task to calculate count of points, length of lines or areas of polygons of the summaryLayer within each polygon in sumWithinLayer.
- shape_unitsOptional string
Specify units to summarize the length or areas when sumShape is set to true. Units is not required to summarize points.
- summary_fieldsOptional list of strings
A list of field names and statistical summary type that you wish to calculate for all features in the summaryLayer that are within each polygon in the sumWithinLayer. Eg:[“fieldname1 summary”, “fieldname2 summary”]
- group_by_fieldOptional string
Specify a field from the summaryLayer features to calculate statistics separately for each unique attribute value.
- minority_majorityOptional bool
This boolean parameter is applicable only when a groupByField is specified. If true, the minority (least dominant) or the majority (most dominant) attribute values within each group, within each boundary will be calculated.
- percent_shapeOptional bool
This boolean parameter is applicable only when a groupByField is specified. If set to true, the percentage of shape (eg. length for lines) for each unique groupByField value is calculated.
- output_nameOptional string
Additional properties such as output feature service name.
- contextOptional string
Additional settings such as processing extent and output spatial reference.
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
- dict with the following keys:
“result_layer” : layer (FeatureCollection) “group_by_summary” : layer (FeatureCollection)
trace_downstream¶
-
analysis.
trace_downstream
(split_distance=None, split_units='Kilometers', max_distance=None, max_distance_units='Kilometers', bounding_polygon_layer=None, source_database=None, generalize=True, output_name=None, context=None, gis=None, estimate=False)¶ Determine the flow paths in a downstream direction from the locations you specify.
input_layer : Required layer (see Feature Input in documentation)
split_distance : Optional float
split_units : Optional string
max_distance : Optional float
max_distance_units : Optional string
bounding_polygon_layer : Optional layer (see Feature Input in documentation)
source_database : Optional string
generalize : Optional bool
output_name : Optional string
context : Optional string
- gis :
Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
- estimate :
Optional Boolean. If True, the number of credits to run the operation will be returned.
trace_layer : layer (FeatureCollection)