arcgis.raster.analytics module

Functions for calling the Raster Analysis Tools. The RasterAnalysisTools service is used by ArcGIS Server to provide distributed raster analysis.

get_datastores

analytics.get_datastores(gis=None)

Returns a helper object to manage raster analytics datastores in the GIS. If a gis isn’t specified, returns datastore manager of arcgis.env.active_gis

is_supported

analytics.is_supported(gis=None)

Returns True if the GIS supports raster analytics. If a gis isn’t specified, checks if arcgis.env.active_gis supports raster analytics

generate_raster

analytics.generate_raster(raster_function, function_arguments=None, output_raster_properties=None, output_name=None, gis=None)

raster_function : Required, see http://resources.arcgis.com/en/help/rest/apiref/israsterfunctions.html

function_arguments : Optional, for specifying input Raster alone, portal Item can be passed

output_raster_properties : Optional

output_name
: Optional. If not provided, an Image Service is created by the method and used as the output raster.
You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_raster : Image layer item

interpolate_points

analytics.interpolate_points(input_point_features, interpolate_field, optimize_for='BALANCE', transform_data=False, size_of_local_models=None, number_of_neighbors=None, output_cell_size=None, output_prediction_error=False, output_name=None, gis=None)

This tool allows you to predict values at new locations based on measurements from a collection of points. The tool takes point data with values at each point and returns a raster of predicted values:

  • An air quality management district has sensors that measure pollution levels. Interpolate Points can be used to

    predict pollution levels at locations that don’t have sensors, such as locations with at-risk populations— schools or hospitals, for example.

  • Predict heavy metal concentrations in crops based on samples taken from individual plants.

  • Predict soil nutrient levels (nitrogen, phosphorus, potassium, and so on) and other indicators (such as electrical

    conductivity) in order to study their relationships to crop yield and prescribe precise amounts of fertilizer for each location in the field.

  • Meteorological applications include prediction of temperatures, rainfall, and associated variables (such as acid

    rain).

input_point_features
: Required point layer containing locations with known values
The point layer that contains the points where the values have been measured.
interpolate_field
: Required string - field to interpolate
Choose the field whose values you wish to interpolate. The field must be numeric.
optimize_for
: Optional string - Choose your preference for speed versus accuracy.
More accurate predictions take longer to calculate. This parameter alters the default values of several other parameters of Interpolate Points in order to optimize speed of calculation, accuracy of results, or a balance of the two. By default, the tool will optimize for balance. One of the following: [‘SPEED’, ‘BALANCE’, ‘ACCURACY’]
transform_data
: Optional bool - Choose whether to transform your data to the normal distribution.
Interpolation is most accurate for data that follows a normal (bell-shaped) distribution. If your data does not appear to be normally distributed, you should perform a transformation.
size_of_local_models
: Optional int - Size of local models
Interpolate Points works by building local interpolation models that are mixed together to create the final prediction map. This parameter controls how many points will be contained in each local model. Smaller values will make results more local and can reveal small-scale effects, but it may introduce some instability in the calculations. Larger values will be more stable, but some local effects may be missed. The value can range from 30 to 500, but typical values are between 50 and 200.
number_of_neighbors
: Optional int - Number of Neighbors
Predictions are calculated based on neighboring points. This parameter controls how many points will be used in the calculation. Using a larger number of neighbors will generally produce more accurate results, but the results take longer to calculate. This value can range from 1 to 64, but typical values are between 5 and 15.
output_cell_size
: Optional LinearUnit - Output cell size
Enter the cell size and unit for the output rasters. The available units are Feet, Miles, Meters, and Kilometers.
output_prediction_error
: Optional bool - Output prediction error
Choose whether you want to create a raster of standard errors for the predicted values. Standard errors are useful because they provide information about the reliability of the predicted values. A simple rule of thumb is that the true value will fall within two standard errors of the predicted value 95 percent of the time. For example, suppose a new location gets a predicted value of 50 with a standard error of 5. This means that this tool’s best guess is that the true value at that location is 50, but it reasonably could be as low as 40 or as high as 60. To calculate this range of reasonable values, multiply the standard error by 2, add this value to the predicted value to get the upper end of the range, and subtract it from the predicted value to get the lower end of the range.
output_name
: Optional. If not provided, an Image Service is created by the method and used as the output raster.
You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

dict with the following keys:
“output_raster” : layer “output_error_raster” : layer “process_info” : layer

create_viewshed

analytics.create_viewshed(input_elevation_surface, input_observer_features, optimize_for=None, maximum_viewing_distance=None, maximum_viewing_distance_field=None, minimum_viewing_distance=None, minimum_viewing_distance_field=None, viewing_distance_is_3d=None, observers_elevation=None, observers_elevation_field=None, observers_height=None, observers_height_field=None, target_height=None, target_height_field=None, above_ground_level_output_name=None, output_name=None, gis=None)

Compute visibility for an input elevation raster using geodesic method.

input_elevation_surface : Required string

input_observer_features : Required FeatureSet

optimize_for
: Optional string
One of the following: [‘SPEED’, ‘ACCURACY’]

maximum_viewing_distance : Optional LinearUnit

maximum_viewing_distance_field : Optional string

minimum_viewing_distance : Optional LinearUnit

minimum_viewing_distance_field : Optional string

viewing_distance_is_3d : Optional bool

observers_elevation : Optional LinearUnit

observers_elevation_field : Optional string

observers_height : Optional LinearUnit

observers_height_field : Optional string

target_height : Optional LinearUnit

target_height_field : Optional string

above_ground_level_output_name : Optional string

output_name
: Optional. If not provided, an Image Service is created by the method and used as the output raster.
You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

dict with the following keys:
“output_raster” : layer “output_above_ground_level_raster” : layer

summarize_raster_within

analytics.summarize_raster_within(input_zone_layer, input_raster_layer_to_summarize, zone_field='Value', statistic_type='Mean', ignore_missing_values=True, output_name=None, gis=None)
input_zone_layer
: Required layer - area layer to summarize a raster layer within defined boundaries.
The layer that defines the boundaries of the areas, or zones, that will be summarized. The layer can be a raster or feature data. For rasters, the zones are defined by all locations in the input that have the same cell value. The areas do not have to be contiguous.
input_raster_layer_to_summarize
: Required - raster layer to summarize.
The raster cells in this layer will be summarized by the areas (zones) that they fall within.
zone_field
: Required string - field to define the boundaries. This is the attribute of the layer that will be used
to define the boundaries of the areas. For example, suppose the first input layer defines the management unit boundaries, with attributes that define the region, the district, and the parcel ID of each unit. You also have a raster layer defining a biodiversity index for each location. With the field you select, you can decide to calculate the average biodiversity at local, district, or regional levels.
statistic_type
: Optional string - statistic to calculate.
You can calculate statistics of any numerical attribute of the points, lines, or areas within the input area layer. The available statistics types when the selected field is integer are Mean, Maximum, Median, Minimum, Minority, Range, Standard deviation(STD), Sum, and Variety. If the field is floating point, the options are Mean, Maximum, Minimum, Range, Standard deviation, and Sum. One of the following: [‘Mean’, ‘Majority’, ‘Maximum’, ‘Median’, ‘Minimum’, ‘Minority’, ‘Range’, ‘STD’, ‘SUM’, ‘Variety’]
ignore_missing_values
: Optional bool.
If you choose to ignore missing values, only the cells that have a value in the layer to be summarized will be used in determining the output value for that area. Otherwise, if there are missing values anywhere in an area, it is deemed that there is insufficient information to perform statistical calculations for all the cells in that zone, and that area will receive a null (NoData) value in the output.
output_name
: Optional. If not provided, an Image Service is created by the method and used as the output raster.
You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_raster : Image layer item

calculate_density

analytics.calculate_density(input_point_or_line_features, count_field=None, search_distance=None, output_area_units=None, output_cell_size=None, output_name=None, gis=None)

Density analysis takes known quantities of some phenomenon and creates a density map by spreading these quantities across the map. You can use this tool, for example, to show concentrations of lightning strikes or tornadoes, access to health care facilities, and population densities.

This tool 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 larger 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.

Other use cases of this tool include the following:

  • Creating crime density maps to help police departments properly allocate resources to high crime areas.
  • Calculating densities of hospitals within a county. The result layer will show areas with high and low accessibility to hospitals, and this information can be used to decide where new hospitals should be built.
  • Identifying areas that are at high risk of forest fires based on historical locations of forest fires.
  • Locating communities that are far from major highways in order to plan where new roads should be constructed.
input_point_or_line_features
: Required feature layer - The input point or line layer that will be used to calculate
the density layer.
count_field
: Optional string - count field
Provide a field 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 the default choice of None is used, then each location will be assumed to represent a single count.
search_distance
: Optional LinearUnit - Search distance
Enter a distance specifying how far to search to find point or line features when calculating density values. For example, if you provide a search distance of 10,000 meters, the density of any location in the output layer is calculated based on features that are within 10,000 meters of the location. Any location that does not have any incidents within 10,000 meters will receive a density value of zero. 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).
output_area_units
: Optional string - Output area units
Specify the output area unit. Density is count divided by area, and this parameter specifies the unit of the area in the density calculation. The available areal units are Square Miles and Square Kilometers.
output_cell_size
: Optional LinearUnit - Output cell size
Enter the cell size and unit for the output rasters.
output_name
: Optional. If not provided, an Image Service is created by the method and used as the output raster.
You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_raster : Image layer item

classify

analytics.classify(input_raster, input_classifier_definition, additional_input_raster=None, output_name=None, gis=None)

input_raster : Required string

input_classifier_definition : Required string

additional_input_raster : Optional string

output_name
: Optional. If not provided, an Image Service is created by the method and used as the output raster.
You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_raster : Image layer item

segment

analytics.segment(input_raster, spectral_detail='15.5', spatial_detail='15', minimum_segment_size_in_pixels='20', band_indexes='0, 1, 2', remove_tiling_artifacts='false', output_name=None, gis=None)

input_raster : Required string

spectral_detail : Required string

spatial_detail : Required string

minimum_segment_size_in_pixels : Required string

band_indexes : Required string

remove_tiling_artifacts : Required string

output_name
: Optional. If not provided, an Image Service is created by the method and used as the output raster.
You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_raster : Image layer item

train_classifier

analytics.train_classifier(input_raster, input_training_sample_json, classifier_parameters, segmented_raster=None, segment_attributes='COLOR;MEAN', gis=None)

input_raster : Required string

input_training_sample_json : Required string

segmented_raster : Optional string

classifier_parameters : Required string

segment_attributes : Required string

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_classifier_definition

convert_feature_to_raster

analytics.convert_feature_to_raster(input_feature, output_cell_size, value_field=None, output_name=None, gis=None)

Creates a new raster dataset from an existing feature dataset. Any feature class containing point, line, or polygon features can be converted to a raster dataset. The cell center is used to decide the value of the output raster pixel. The input field type determines the type of output raster. If the field is integer, the output raster will be integer; if it is floating point, the output will be floating point.

input_feature : Required. The input feature layer to convert to a raster dataset.

output_cell_size
: Required LinearUnit. The cell size and unit for the output rasters.
The available units are Feet, Miles, Meters, and Kilometers.

value_field : Optional string. The field that will be used to assign values to the output raster.

output_name
: Optional. The name of the layer that will be created in My Content.
If not provided, an Image Service is created by the method and used as the output raster. You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_raster : Image layer item

convert_raster_to_feature

analytics.convert_raster_to_feature(input_raster, field='Value', output_type='Point', simplify_lines_or_polygons=True, output_name=None, gis=None)

This service tool converts imagery data to feature class vector data.

input_raster : Required string

field
: Optional string - field that specifies which value will be used for the conversion.
It can be any integer or text value. A field containing floating-point values can only be used if the output is to a point dataset. The default choice is to use the Value field, which contains the value in each raster cell.
output_type
: Optional string
One of the following: [‘Point’, ‘Line’, ‘Polygon’]

simplify_lines_or_polygons : Optional bool

output_name
: Optional. If not provided, an Feature layer is created by the method and used as the output .
You can pass in an existing Feature Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Feature Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_features : Image layer item

copy_raster

analytics.copy_raster(input_raster, output_cellsize=None, resampling_method='NEAREST', clip_setting=None, output_name=None, gis=None)

input_raster : Required string

output_cellsize : Optional string

resampling_method
: Optional string
One of the following: [‘NEAREST’, ‘BILINEAR’, ‘CUBIC’, ‘MAJORITY’]

clip_setting : Optional string

output_name
: Optional. If not provided, an Image Service is created by the method and used as the output raster.
You can pass in an existing Image Service Item from your GIS to use that instead. Alternatively, you can pass in the name of the output Image Service that should be created by this method to be used as the output for the tool. A RuntimeError is raised if a service by that name already exists

gis: Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

output_raster : Image layer item