arcgis.raster module¶
The arcgis.raster module containing classes and raster analysis functions for working with raster data and imagery layers.
Raster data is made up of a grid of cells, where each cell or pixel can have a value. Raster data is useful for storing data that varies continuously, as in a satellite image, a surface of chemical concentrations, or an elevation surface.
Use arcgis.raster.analytics.is_supported(gis)
to check if raster analysis is supported in your GIS.
ImageryLayer¶
-
class
arcgis.raster.
ImageryLayer
(url, gis=None)¶ The ImageryLayer class can be used to represent an image service resource as a layer. An ImageryLayer object retrieves and displays data from image services. ImageryLayer allows you to and apply server defined or client-defined raster functions (e.g. remap, colormap), and mosaic rules.
ImageryLayer objects can also be created using raster datasets or raster products present in datastore registered with the server/active GIS (types: fileShares, cloudStores, rasterStores). To learn more about datastores, visit think link.
Usage:
arcgis.raster.ImageryLayer(url, gis=gis)
Argument
Description
url
Required string. The input raster path
Example:
url = “https://myserver/arcgis/rest/services/ImageServiceName/ImageServer”
url = “/fileShares/file_share_name/path/to/raster”
url = “/cloudStores/cloud_store_name/path/to/raster”
Note: When working with datastore rasters or non image service urls, RasterRendering service should be enabled in the active GIS connection
gis
Optional. GIS of the ImageryLayer object.
# Example Usage # Imagery layer items are available as content in the GIS. Items can be searched using gis.content.search() # This snippet creates an imagery layer using the 'layers' property of the searched Imagery Layer Item img_lyr = gis.content.search("my_image_service", item_type="Imagery Layer")[0].layers[0] # Create an imagery layer from an image service url img_lyr = ImageryLayer("https://myserver/arcgis/rest/services/ImageServiceName/ImageServer", gis=gis) # Create an imagery layer from a .tif file present in user's registered fileShare datastore # (Requires RasterRendering service to be enabled in the active GIS) img_lyr = ImageryLayer("/fileShares/data/Amberg.tif", gis=gis) # Create an imagery layer from a publicly accesible Cloud-Optimized GeoTIFF # (Requires RasterRendering service to be enabled in the active GIS) img_lyr = ImageryLayer("https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/43/M/BP/2021/6/S2A_43MBP_20210622_0_L2A/B08.tif", gis=gis) # Overlay an imagery layer on the 'MapView' widget map = gis.map() map.add_layer(img_lyr)
-
attribute_table
(rendering_rule=None)¶ The attribute_table method returns categorical mapping of pixel values (for example, a class, group, category, or membership).
Arguments
Description
rendering_rule
Specifies the rendering rule for how the requested image should be processed. The response is updated Layer info that reflects a custom processing as defined by the rendering rule. For example, if renderingRule contains an attributeTable function, the response will indicate “hasRasterAttributeTable”: true; if the renderingRule contains functions that alter the number of bands, the response will indicate a correct bandCount value.
- Returns
dictionary
-
property
band_count
¶ returns the band count of the imagery layer
-
blend
()¶ overlapping pixels at the same location are resolved by blending all overlapping pixels
- Returns
this imagery layer with mosaic operation set to ‘blend’
-
property
cache_manager
¶ Provides access to the tools to update, add, and remove cache on the ImageLayer
- Returns
ImageryLayerCacheManager or None
-
calculate_volume
(geometries, base_type=None, mosaic_rule=None, constant_z=None, pixel_size=None)¶ Performs volumetric calculation on an elevation service. Results are always in square meters (area) and cubic meters (volume). If a service does not have vertical spatial reference and z unit is not in meters, user needs to apply a conversion factor when interpreting results.
Available in 10.7+ only
Argument
Description
geometries
required a list of Polygon geometry objects or a list of envelope geometry objects. A geometry that defines the geometry within which the volume is computed. The geometry can be an envelope or a polygon
base_type
optional integer. 0 - constant z; 1 - best fitting plane; 2 - lowest elevation on the perimeter; 3 - highest elevation on the perimeter; 4 - average elevation on the perimeter
mosaic_rule
Optional dictionary. Used to select different DEMs in a mosaic dataset
constant_z
Optional integer. parameter to specify constant z value
pixel_size
Optional string or dictionary. Defines the spatial resolution at which volume calculation is performed Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
- Returns
dictionary showing volume values for each geometry in the input geometries array
-
catalog_item
(id)¶ catalog_item() returns a single raster catalog item associated with the specified id
Arguments
Description
id
required integer. The id is the ‘raster id’.
- Returns
Raster Catalog Item associated with the id
-
colormap
(rendering_rule=None, variable=None)¶ The colormap method returns RGB color representation of pixel values. This method is supported if the hasColormap property of the layer is true.
Argument
Description
rendering_rule
optional dictionary. Specifies the rendering rule for how the requested image should be rendered. See the raster function objects for the JSON syntax and examples: https://developers.arcgis.com/documentation/common-data-types/raster-function-objects.htm
variable
Optional String. This parameter can be used to request a colormap for each variable for an image service that has multidimensional information. It will return a colormap for the whole image service if not specified. Eligible variable names can be queried from multidimensional_info property of the Imagery Layer object. This parameter is available from 10.8.1
- Returns
dictionary
-
property
columns
¶ returns number of columns in the imagery layer
-
compute_class_stats
(descriptions, mosaic_rule='defaultMosaicMethod', rendering_rule=None, pixel_size=None)¶ Compute class statistics signatures (used by the maximum likelihood classifier)
Argument
Description
descriptions
Required list. Class descriptions are training site polygons and their class descriptions. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.
- Syntax
{“classes”: [ // An list of classes{“id” : <id>,“name” : “<name>”,“geometry” : <geometry> //polygon},{“id” : <id>,“name” : “<name>”,“geometry” : <geometry> //polygon}…]}mosaic_rule
optional string. Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image layer will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue). See Mosaic rule objects help for more information: https://developers.arcgis.com/documentation/common-data-types/mosaic-rules.htm
rendering_rule
optional dictionary. Specifies the rendering rule for how the requested image should be rendered. See the raster function objects for the JSON syntax and examples: https://developers.arcgis.com/documentation/common-data-types/raster-function-objects.htm
pixel_size
optional string or dictionary. The pixel level being used (or the resolution being looked at). If pixel size is not specified, then pixel_size will default to the base resolution of the dataset. The structure of the pixel_size parameter is the same as the structure of the point object returned by the ArcGIS REST API. In addition to the dictionary structure, you can specify the pixel size with a comma-separated syntax.
- Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
- Returns
dictionary
-
compute_histograms
(geometry, mosaic_rule=None, rendering_rule=None, pixel_size=None, time=None, process_as_multidimensional=False)¶ The result of this operation is an array of histograms for all raster bands computed for the imagery layer from the given extent
Arguments
Description
geometry
required Polygon or Extent. A geometry that defines the geometry within which the histogram is computed. The geometry can be an envelope or a polygon
mosaic_rule
optional string. Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image layer will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue). See Mosaic rule objects help for more information: https://developers.arcgis.com/documentation/common-data-types/mosaic-rules.htm
rendering_rule
Specifies the rendering rule for how the requested image should be processed. The response is updated Layer info that reflects a custom processing as defined by the rendering rule. For example, if renderingRule contains an attributeTable function, the response will indicate “hasRasterAttributeTable”: true; if the renderingRule contains functions that alter the number of bands, the response will indicate a correct bandCount value.
pixel_size
optional string or dictionary. The pixel level being used (or the resolution being looked at). If pixel size is not specified, then pixel_size will default to the base resolution of the dataset. The structure of the pixel_size parameter is the same as the structure of the point object returned by the ArcGIS REST API. In addition to the dictionary structure, you can specify the pixel size with a comma-separated string.
- Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
time
optional datetime.date, datetime.datetime or timestamp string. The time instant or the time extent of the exported image. Time instant specified as datetime.date, datetime.datetime or timestamp in milliseconds since epoch Syntax: time=<timeInstant>
Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp
Added at 10.8
process_as_multidimensional
optional boolean. Specifies whether to process the image service as a multidimensional image service.
False - The histogram of pixel values from only the first slice is computed. This is the default.
True - The image service is treated as a multidimensional raster, and histograms of pixel values from all selected slices are computed.
Added at 10.9 for image services which use ArcObjects11 or ArcObjectsRasterRendering as the service provider.
- Returns
dict
# Usage Example 1: Compute the histograms in the specified area of interest for a time instant. aoi = { "spatialReference": {"wkid": 32610}, "xmax": 725000, "xmin": 720000, "ymax": 4300000, "ymin": 4250000, } aoi_geometry = Geometry(aoi) comp_hist_01 = img_lyr.compute_histograms(geometry=aoi, rendering_rule={"rasterFunction":None}, time="1326650400000")
# Usage Example 2: Compute the histograms in the specified area of interest for a time extent. aoi = { "spatialReference": {"wkid": 32610}, "xmax": 725000, "xmin": 720000, "ymax": 4300000, "ymin": 4250000, } aoi_geometry = Geometry(aoi) # If the datetime object is not in the UTC timezone, the API will internally convert it to the UTC timezone. start = datetime.datetime(2012,1,15,18,0,0, tzinfo=datetime.timezone.utc) end = datetime.datetime(2012,1,15,21,0,0, tzinfo=datetime.timezone.utc) comp_hist_02 = img_lyr.compute_histograms(geometry=aoi, rendering_rule={"rasterFunction":None}, time=[start, end])
-
compute_pixel_location
(raster_id, geometries, spatial_reference)¶ With given input geometries, it calculates corresponding pixel location in column and row on specific raster catalog item. A prerequisite is that the raster catalog item has valid icsToPixel resource.
Arguments
Description
raster_id
required integer. Specifies the objectId of image service’s raster catalog. This integer rasterId number will determine which raster’s image coordinate system will be used during the calculation and which raster does the column and row of results represent.
geometries
The array of geometries for computing pixel locations. All geometries in this array should be of the type defined by geometryType.
spatial_reference
required string, dictionary, This specifies the spatial reference of the Geometries parameter above. It can accept a multitudes of values. These can be a WKID, image coordinate system (ICSID), or image coordinate system in json/dict format. Additionally the arcgis.geometry.SpatialReference object is also a valid entry.
Note
An image coordinate system ID can be specified using 0:icsid; for example, 0:64. The extra 0: is used to avoid conflicts with wkid
- Returns
dictionary, The result of this operation includes x and y values for the column and row of each input geometry. It also includes a z value for the height at given location based on elevation info that the catalog raster item has.
-
compute_stats_and_histograms
(geometry, mosaic_rule=None, rendering_rule=None, pixel_size=None, time=None, process_as_multidimensional=False)¶ The result of this operation contains both statistics and histograms computed for the imagery layer from the given extent.
Argument
Description
geometry
required Polygon or Extent. A geometry that defines the geometry within which the histogram is computed. The geometry can be an envelope or a polygon
mosaic_rule
optional dictionary. Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image layer will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue).
rendering_rule
optional dictionary. Specifies the rendering rule for how the requested image should be rendered.
pixel_size
optional string or dict. The pixel level being used (or the resolution being looked at). If pixel size is not specified, then pixel_size will default to the base resolution of the dataset. The raster at the specified pixel size in the mosaic dataset will be used for histogram calculation.
- Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
time
optional datetime.date, datetime.datetime or timestamp string. The time instant or the time extent of the exported image. Time instant specified as datetime.date, datetime.datetime or timestamp in milliseconds since epoch Syntax: time=<timeInstant>
Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp
Added at 10.8
process_as_multidimensional
optional boolean. Specifies whether to process the image service as a multidimensional image service.
False - Statistics and histograms of pixel values from only the first slice is computed. This is the default.
True - The image service is treated as a multidimensional raster, and statistics and histograms of pixel values from all selected slices are computed.
Added at 10.9 for image services which use ArcObjects11 or ArcObjectsRasterRendering as the service provider.
- Returns
dictionary
# Usage Example 1: Compute the stats and histograms in the specified area of interest for a time instant. aoi = { "spatialReference": {"wkid": 32610}, "xmax": 725000, "xmin": 720000, "ymax": 4300000, "ymin": 4250000, } aoi_geometry = Geometry(aoi) comp_stats_hist_01 = img_lyr.compute_stats_and_histograms(geometry=aoi, rendering_rule={"rasterFunction":None}, time="1326650400000")
# Usage Example 2: Compute the stats and histograms in the specified area of interest for a time extent. aoi = { "spatialReference": {"wkid": 32610}, "xmax": 725000, "xmin": 720000, "ymax": 4300000, "ymin": 4250000, } aoi_geometry = Geometry(aoi) # If the datetime object is not in the UTC timezone, the API will internally convert it to the UTC timezone. start = datetime.datetime(2012,1,15,18,0,0, tzinfo=datetime.timezone.utc) end = datetime.datetime(2012,1,15,21,0,0, tzinfo=datetime.timezone.utc) comp_stats_hist_02 = img_lyr.compute_stats_and_histograms(geometry=aoi, rendering_rule={"rasterFunction":None}, time=[start,end])
-
compute_tie_points
(raster_id, geodata_transforms)¶ The result of this operation contains tie points that can be used to match the source image to the reference image. The reference image is configured by the image layer publisher. For more information, see Fundamentals for georeferencing a raster dataset.
Argument
Description
raster_id
required integer. Source raster ID.
geodata_transforms
required dictionary. The geodata transformation that provides a rough fit of the source image to the reference image. For example, a first order polynomial transformation that fits the source image to the expected location.
- Returns
dictionary
-
draw_graph
(show_attributes=False, graph_size='14.25, 15.25')¶ Displays a structural representation of the function chain and it’s raster input values. If show_attributes is set to True, then the draw_graph function also displays the attributes of all the functions in the function chain, representing the rasters in a blue rectangular box, attributes in green rectangular box and the raster function names in yellow.
Argument
Description
show_attributes
optional boolean. If True, the graph displayed includes all the attributes of the function and not only it’s function name and raster inputs Set to False by default, to display only he raster function name and the raster inputs to it.
graph_size
optional string. Maximum width and height of drawing, in inches, seperated by a comma. If only a single number is given, this is used for both the width and the height. If defined and the drawing is larger than the given size, the drawing is uniformly scaled down so that it fits within the given size.
- Returns
Graph
# Usage Example: Draws the function chain applied on the ImageryLayer object created from an Image service. imagery_layer = ImageryLayer("https://myserver/arcgis/rest/services/ImageServiceName/ImageServer", gis=gis) grayscale_layer = grayscale(raster=imagery_layer) invert_layer = boolean_not(rasters=[grayscale_layer]) invert_layer.draw_graph(show_attributes=True)
-
export_image
(bbox=None, image_sr=None, bbox_sr=None, size=None, time=None, export_format='jpgpng', pixel_type=None, no_data=None, no_data_interpretation='esriNoDataMatchAny', interpolation=None, compression=None, compression_quality=None, band_ids=None, mosaic_rule=None, rendering_rule=None, f='json', save_folder=None, save_file=None, compression_tolerance=None, adjust_aspect_ratio=None, lerc_version=None, slice_id=None)¶ The export_image operation is performed on an imagery layer. The result of this operation is an image method. This method provides information about the exported image, such as its URL, extent, width, and height. In addition to the usual response formats of HTML and JSON, you can also request the image format while performing this operation. When you perform an export with the image format , the server responds by directly streaming the image bytes to the client. With this approach, you don’t get any information associated with the exported image other than the image itself.
Arguments
Description
bbox
Optional dict or string. The extent (bounding box) of the exported image. Unless the bbox_sr parameter has been specified, the bbox is assumed to be in the spatial reference of the imagery layer.
The bbox should be specified as an arcgis.geometry.Envelope object, it’s json representation or as a list or string with this format: ‘<xmin>, <ymin>, <xmax>, <ymax>’ If omitted, the extent of the imagery layer is used
image_sr
optional string, SpatialReference. The spatial reference of the exported image. The spatial reference can be specified as either a well-known ID, it’s json representation or as an arcgis.geometry.SpatialReference object. If the image_sr is not specified, the image will be exported in the spatial reference of the imagery layer.
bbox_sr
optional string, SpatialReference. The spatial reference of the bbox. The spatial reference can be specified as either a well-known ID, it’s json representation or as an arcgis.geometry.SpatialReference object. If the image_sr is not specified, bbox is assumed to be in the spatial reference of the imagery layer.
size
optional list. The size (width * height) of the exported image in pixels. If size is not specified, an image with a default size of 1200*450 will be exported. Syntax: list of [width, height]
time
optional datetime.date, datetime.datetime or timestamp string. The time instant or the time extent of the exported image. Time instant specified as datetime.date, datetime.datetime or timestamp in milliseconds since epoch Syntax: time=<timeInstant>
Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp
export_format
optional string. The format of the exported image. The default format is jpgpng. The jpgpng format returns a JPG if there are no transparent pixels in the requested extent; otherwise, it returns a PNG (png32).
Values: jpgpng,png,png8,png24,jpg,bmp,gif,tiff,png32,bip,bsq,lerc
pixel_type
optional string. The pixel type, also known as data type, pertains to the type of values stored in the raster, such as signed integer, unsigned integer, or floating point. Integers are whole numbers, whereas floating points have decimals.
no_data
optional float. The pixel value representing no information.
no_data_interpretation
optional string. Interpretation of the no_data setting. The default is NoDataMatchAny when no_data is a number, and NoDataMatchAll when no_data is a comma-delimited string: NoDataMatchAny,NoDataMatchAll.
interpolation
optional string. The resampling process of extrapolating the pixel values while transforming the raster dataset when it undergoes warping or when it changes coordinate space. One of: RSP_BilinearInterpolation, RSP_CubicConvolution, RSP_Majority, RSP_NearestNeighbor
compression
optional string. Controls how to compress the image when exporting to TIFF format: None, JPEG, LZ77. It does not control compression on other formats.
compression_quality
optional integer. Controls how much loss the image will be subjected to by the compression algorithm. Valid value ranges of compression quality are from 0 to 100.
band_ids
optional list. If there are multiple bands, you can specify a single band to export, or you can change the band combination (red, green, blue) by specifying the band number. Band number is 0 based. Specified as list of ints, eg [2,1,0]
mosaic_rule
optional dict. Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image layer will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue).
rendering_rule
optional dict. Specifies the rendering rule for how the requested image should be rendered.
f
optional string. The response format. default is json Values: json,image,kmz,numpy_array
Note: If f=”numpy_array” and if the raster is a single or multiband raster, the dimensions of the array will be rows, columns, and number of bands. If the raster is a multidimensional raster, the dimensions of the array will be number of slices, rows, columns, and number of bands. LERC needs to be installed to export image service as numpy array.
If f=”image”, the bytes of the exported image are returned unless save_folder and save_file parameters are also passed, in which case the image is written to the specified file
save_folder
optional string. The folder in which the exported image is saved when f=image
save_file
optional string. The file in which the exported image is saved when f=image
compression_tolerance
optional float. Controls the tolerance of the lerc compression algorithm. The tolerance defines the maximum possible error of pixel values in the compressed image. Example: compression_tolerance=0.5 is loseless for 8 and 16 bit images, but has an accuracy of +-0.5 for floating point data. The compression tolerance works for the LERC format only.
adjust_aspect_ratio
optional boolean. Indicates whether to adjust the aspect ratio or not. By default adjust_aspect_ratio is true, that means the actual bbox will be adjusted to match the width/height ratio of size paramter, and the response image has square pixels.
lerc_version
optional integer. The version of the Lerc format if the user sets the format as lerc. Values: 1 or 2 If a version is specified, the server returns the matching version, or otherwise the highest version available.
slice_id
optional integer. Exports the given slice of a multidimensional raster. To get the slice index use slices method on the ImageryLayer object.
- Returns
dict or string
# Usage Example: Exports an ImageryLayer object (created using Image Service) to a local location in tiff format imagery_layer = ImageryLayer("https://myserver/arcgis/rest/services/ImageServiceName/ImageServer", gis=gis) imagery_layer.export_image(size=[1400, 600], export_format="tiff", f="image", save_folder=r"/path/to/save_folder", save_file="my_raster.tif")
-
property
extent
¶ Area of interest. Used for displaying the imagery layer when queried
-
filter_by
(where=None, geometry=None, time=None, lock_rasters=True)¶ Filters the layer by where clause, geometry and temporal filters
Arguments
Description
where
optional string. A where clause on this layer to filter the imagery layer by the selection sql statement. Any legal SQL where clause operating on the fields in the raster
geometry
optional arcgis.geometry.filters. To filter results by a spatial relationship with another geometry
time
optional datetime, date, or timestamp. A temporal filter to this layer to filter the imagery layer by time using the specified time instant or the time extent.
Syntax: time_filter=<timeInstant>
Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time_filter=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp in milliseconds
lock_rasters
optional boolean. If True, the LockRaster mosaic rule will be applied to the layer, unless overridden
- Returns
ImageryLayer with filtered images meeting the filter criteria
-
filtered_rasters
()¶ The object ids of the filtered rasters in this imagery layer, by applying the where clause, spatial and temporal filters. If no rasters are filtered, returns None. If all rasters are filtered, returns empty list
-
first
()¶ overlapping pixels at the same location are resolved by picking the first image :return: this imagery layer with mosaic operation set to ‘first’
-
classmethod
fromitem
(item)¶ Create Imagery Layer from GIS Item
-
get_download_info
(raster_ids, polygon=None, extent=None, out_format=None)¶ The get_download_info() operation returns information (the file ID) that can be used to download the raw raster files that are associated with a specified set of rasters in the raster catalog.
Argument
Description
raster_ids
required string. A comma-separated list of raster IDs whose files are to be downloaded.
polygon
optional Polygon, The geometry to apply for clipping
extent
optional string. The geometry to apply for clipping example: “-104,35.6,-94.32,41”
out_format
optional string. The format of the rasters returned. If not specified, the rasters will be in their native format. The format applies when the clip geometry is also specified, and the format will be honored only when the raster is clipped.
To force the Download Rasters operation to convert source images to a different format, append :Conversion after format string. Valid formats include: TIFF, Imagine Image, JPEG, BIL, BSQ, BIP, ENVI, JP2, GIF, BMP, and PNG. Example: out_format=’TIFF’
- Returns
dictionary
-
get_histograms
(variable=None)¶ Returns the histograms of each band in the imagery layer as a list of dictionaries corresponding to each band. get_histograms get_histograms() can return histogram for each variable if used with multidimensional ImageryLayer object by specifing value for variable parameter.
If histogram is not found, returns None. In this case, call the compute_histograms(). (get_histograms() is an enhanced version of the histograms property on the ImageryLayer class with additional variable parameter.)
Arguments
Description
variable
Optional string. For an image service that has multidimensional information, this parameter can be used to request histograms for each variable. It will return histograms for the whole ImageryLayer if not specified. This parameter is available from 10.8.1
- Returns
my_hist = imagery_layer.histograms(variable=”water_temp”)
Structure of the return value: [{“size”:256, “min”:560, “max”:24568, counts: [10,99,56,42200,125,….] } ]
#length of this list corresponds ‘size’
-
get_raster_file
(download_info, out_folder=None)¶ The get_raster_file() method returns a list of raw raster files. The download_info is obtained by using the get_download_info() operation.
Argument
Description
download_info
required dictionary. This is derived from the get_downlad_info().
out_folder
optional string. Path to the file save location. If the value is None, the OS temporary directory is used.
- Returns
list of files downloaded
-
get_samples
(geometry, geometry_type=None, sample_distance=None, sample_count=None, mosaic_rule=None, pixel_size=None, return_first_value_only=None, interpolation=None, out_fields=None)¶ The get_samples operation is supported by both mosaic dataset and raster dataset imagery layers. The result of this operation includes sample point locations, pixel values, and corresponding spatial resolutions of the source data for a given geometry. When the input geometry is a polyline, envelope, or polygon, sampling is based on sample_count or sample_distance; when the input geometry is a point or multipoint, the point or points are used directly. The number of sample locations in the response is based on the sample_distance or sample_count parameter and cannot exceed the limit of the image layer (the default is 1000, which is an approximate limit).
Argument
Description
geometry
A geometry that defines the location(s) to be sampled. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. Applicable geometry types are point, multipoint, polyline, polygon, and envelope. When spatial reference is omitted in the input geometry, it will be assumed to be the spatial reference of the image layer.
geometry_type
optional string. The type of geometry specified by the geometry parameter. The geometry type can be point, multipoint, polyline, polygon, or envelope.
sample_distance
optional float. The distance interval used to sample points from the provided path. The unit is the same as the input geometry. If neither sample_count nor sample_distance is provided, no densification can be done for paths (polylines), and a default sample_count (100) is used for areas (polygons or envelopes).
sample_count
optional integer. The approximate number of sample locations from the provided path. If neither sample_count nor sample_distance is provided, no densification can be done for paths (polylines), and a default sample_count (100) is used for areas (polygons or envelopes).
mosaic_rule
optional dictionary. Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image layer will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue).
pixel_size
optional string or dict. The pixel level being used (or the resolution being looked at). If pixel size is not specified, then pixel_size will default to the base resolution of the dataset. The raster at the specified pixel size in the mosaic dataset will be used for histogram calculation.
- Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
return_first_value_only
optional boolean. Indicates whether to return all values at a point, or return the first non-NoData value based on the current mosaic rule. The default is true.
interpolation
optional string. The resampling method. Default is nearest neighbor. Values: RSP_BilinearInterpolation,RSP_CubicConvolution,
RSP_Majority,RSP_NearestNeighbor
out_fields
optional string. The list of fields to be included in the response. This list is a comma-delimited list of field names. You can also specify the wildcard character (*) as the value of this parameter to include all the field values in the results.
-
property
height
¶ returns height of image service
-
property
histograms
¶ Returns the histograms of each band in the imagery layer as a list of dictionaries corresponding to each band. If not histograms is found, returns None. In this case, call the compute_histograms()
- Syntax
my_hist = imagery_layer.histograms()
- Returns
- #Structure of the return value for a two band imagery layer[{#band 1”size”:256,”min”:560,”max”:24568,”counts”: [10,99,56,42200,125,….] #length of this list corresponds ‘size’},{#band 2”size”:256,”min”:8000,”max”:15668,”counts”: [45,9,690,86580,857,….] #length of this list corresponds ‘size’}]
-
identify
(geometry, mosaic_rule=None, rendering_rules=None, pixel_size=None, time_extent=None, return_geometry=False, return_catalog_items=True, return_pixel_values=True, max_item_count=None, slice_id=None, process_as_multidimensional=False)¶ It identifies the content of an image layer for a given location and a given mosaic rule. The location can be a point or a polygon.
The identify operation is supported by both mosaic dataset and raster dataset image services.
The result of this operation includes the pixel value of the mosaic for a given mosaic rule, a resolution (pixel size), and a set of catalog items that overlap the given geometry. The single pixel value is that of the mosaic at the centroid of the specified location. If there are multiple rasters overlapping the location, the visibility of a raster is determined by the order of the rasters defined in the mosaic rule. It also contains a set of catalog items that overlap the given geometry. The catalog items are ordered based on the mosaic rule. A list of catalog item visibilities gives the percentage contribution of the item to overall mosaic.
Arguments
Description
geometry
required dictionary/Point/Polygon. A geometry that defines the location to be identified. The location can be a point or polygon.
mosaic_rule
optional string or dict. Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image layer will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue).
rendering_rules
optional dictionary/list. Specifies the rendering rule for how the requested image should be rendered.
pixel_size
optional string or dict. The pixel level being identified (or the resolution being looked at). Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
time_extent
optional list of datetime objects or datetime object. The time instant or time extent of the raster to be identified. This parameter is only valid if the image layer supports time.
return_geometry
optional boolean. Default is False. Indicates whether or not to return the raster catalog item’s footprint. Set it to false when the catalog item’s footprint is not needed to improve the identify operation’s response time.
return_catalog_items
optional boolean. Indicates whether or not to return raster catalog items. Set it to false when catalog items are not needed to improve the identify operation’s performance significantly. When set to false, neither the geometry nor attributes of catalog items will be returned.
return_pixel_values
optional boolean. Indicates whether to return the pixel values of all mosaicked raster catalog items under the requested geometry.
Set it to false when only the pixel value of mosaicked output is needed at requested geometry.
The default value of this parameter is true.
Added at 10.6.1.
max_item_count
optional int. If the return_catalog_items parameter is set to true, this parameter will take effect. The default behavior is to return all raster catalog items within the requested geometry. Otherwise, the number of items returned will be the value specified in the max_item_count or all eligible items, whichever is smaller.
Added at 10.6.1.
- Example:
2
slice_id
optional int. The slice ID of multidimensional raster. The identify operation will be performed for the specified slice. To get the slice ID use slices method on the ImageryLayer object.
Added at 10.9 for image services which use ArcObjects11 or ArcObjectsRasterRendering as the service provider.
- Example:
1
process_as_multidimensional
optional boolean. Specifies whether to process the image service as a multidimensional image service.
False - Pixel values of the specified rendering rules and mosaic rule at the specified geometry will be returned. This is the default.
True - The image service is treated as a multidimensional raster, and pixel values from all slices, along with additional properties describing the slices, will be returned.
Added at 10.9 for image services which use ArcObjects11 or ArcObjectsRasterRendering as the service provider.
- Returns
dictionary
-
key_properties
(rendering_rule=None)¶ returns key properties of the imagery layer, such as band properties
Argument
Description
rendering_rule
optional dictionary. Specifies the rendering rule for how the requested image should be rendered.
- Returns
key properties of the imagery layer
-
last
()¶ overlapping pixels at the same location are resolved by picking the last image
- Returns
this imagery layer with mosaic operation set to ‘last’
-
legend
(band_ids=None, rendering_rule=None, as_html=False)¶ The legend information includes the symbol images and labels for each symbol. Each symbol is generally an image of size 20 x 20 pixels at 96 DPI. Symbol sizes may vary slightly for some renderer types (e.g., Vector Field Renderer). Additional information in the legend response will include the layer name, layer type, label, and content type. The legend symbols include the base64 encoded imageData. The symbols returned in response to an image layer legend request reflect the default renderer of the image layer or the renderer defined by the rendering rule and band Ids.
Argument
Description
band_ids
optional string. If there are multiple bands, you can specify a single band, or you can change the band combination (red, green, blue) by specifying the band ID. Band ID is 0 based. Example: bandIds=2,1,0
rendering_rule
optional dictionary. Specifies the rendering rule for how the requested image should be rendered.
as_html
optional bool. Returns an HTML table if True
- Returns
legend as a dictionary by default, or as an HTML table if as_html is True
-
max
()¶ overlapping pixels at the same location are resolved by picking the max pixel value
- Returns
this imagery layer with mosaic operation set to ‘max’
-
mean
()¶ overlapping pixels at the same location are resolved by choosing the mean of all overlapping pixels
- Returns
this imagery layer with mosaic operation set to ‘mean’
-
measure
(from_geometry, to_geometry=None, measure_operation=None, pixel_size=None, mosaic_rule=None, linear_unit=None, angular_unit=None, area_unit=None)¶ The function lets a user measure distance, direction, area, perimeter, and height from an image layer. The result of this operation includes the name of the raster dataset being used, sensor name, and measured values. The measure operation can be supported by image services from raster datasets and mosaic datasets. Spatial reference is required to perform basic measurement (distance, area, and so on). Sensor metadata (geodata transformation) needs to be present in the data source used by an image layer to enable height measurement (for example, imagery with RPCs). The mosaic dataset or Layer needs to include DEM to perform 3D measure.
Arguments
Description
from_geometry
required Geometry or dictionary. A geometry that defines the “from” location of the measurement.
to_geometry
optional Geometry or dictionary. A geometry that defines the “to” location of the measurement. The type of geometry must be the same as from_geometry.
measure_operation
optional string or dict. Specifies the type of measure being performed.
Values: Point, DistanceAndAngle, AreaAndPerimeter, HeightFromBaseAndTop, HeightFromBaseAndTopShadow, HeightFromTopAndTopShadow, Centroid, Point3D, DistanceAndAngle3D, AreaAndPerimeter3D, Centroid3D
Different measureOperation types require different from and to geometries:
Point and Point3D-Require only from_geometry, type: {Point}
DistanceAndAngle, DistanceAndAngle3D, HeightFromBaseAndTop, HeightFromBaseAndTopShadow, and HeightFromTopAndTopShadow - Require both from_geometry and to_geometry, type: {Point}
AreaAndPerimeter, AreaAndPerimeter3D, Centroid, and Centroid3D - Require only from_geometry, type: {Polygon}, {Envelope}
Supported measure operations can be derived from the mensurationCapabilities in the image layer root resource. Basic capability supports Point, DistanceAndAngle, AreaAndPerimeter, and Centroid. Basic and 3Dcapabilities support Point3D, DistanceAndAngle3D,AreaAndPerimeter3D, and Centroid3D. Base-Top Height capability supports HeightFromBaseAndTop. Top-Top Shadow Height capability supports HeightFromTopAndTopShadow. Base-Top Shadow Height capability supports HeightFromBaseAndTopShadow.
pixel_size
optional string or dict. The pixel level (resolution) being measured. If pixel size is not specified, pixel_size will default to the base resolution of the image layer. The raster at the specified pixel size in the mosaic dataset will be used for measurement. Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
mosaic_rule
optional string or dict. Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image layer will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue). The first visible image is used by measure.
linear_unit
optional string. The linear unit in which height, length, or perimeters will be calculated. It can be any of the following U constant. If the unit is not specified, the default is Meters. The list of valid Units constants include: Inches,Feet,Yards,Miles,NauticalMiles, Millimeters,Centimeters,Decimeters,Meters, Kilometers
angular_unit
optional string. The angular unit in which directions of line segments will be calculated. It can be one of the following DirectionUnits constants: DURadians, DUDecimalDegrees If the unit is not specified, the default is DUDecimalDegrees.
area_unit
optional string. The area unit in which areas of polygons will be calculated. It can be any AreaUnits constant. If the unit is not specified, the default is SquareMeters. The list of valid AreaUnits constants include: SquareInches,SquareFeet,SquareYards,Acres, SquareMiles,SquareMillimeters,SquareCentimeters, SquareDecimeters,SquareMeters,Ares,Hectares, SquareKilometers
- Returns
dictionary
-
min
()¶ overlapping pixels at the same location are resolved by picking the min pixel value
- Returns
this imagery layer with mosaic operation set to ‘min’
-
mosaic_by
(method=None, sort_by=None, sort_val=None, lock_rasters=None, viewpt=None, asc=True, where=None, fids=None, muldidef=None, op='first', item_rendering_rule=None)¶ Defines how individual images in this layer should be mosaicked. It specifies selection, mosaic method, sort order, overlapping pixel resolution, etc. Mosaic rules are for mosaicking rasters in the mosaic dataset. A mosaic rule is used to define:
The selection of rasters that will participate in the mosaic (using where clause).
The mosaic method, e.g. how the selected rasters are ordered.
The mosaic operation, e.g. how overlapping pixels at the same location are resolved.
Argument
Description
method
optional string. Determines how the selected rasters are ordered. str, can be none,center,nadir,northwest,seamline,viewpoint, attribute,lock-raster required if method is: center,nadir,northwest,seamline, optional otherwise. If no method is passed “none” method is used, which uses the order of records to sort If sort_by and optionally sort_val parameters are specified, “attribute” method is used If lock_rasters are specified, “lock-raster” method is used If a viewpt parameter is passed, “viewpoint” method is used.
sort_by
optional string. field name when sorting by attributes
sort_val
optional string. A constant value defining a reference or base value for the sort field when sorting by attributes
lock_rasters
optional, an array of raster Ids. All the rasters with the given list of raster Ids are selected to participate in the mosaic. The rasters will be visible at all pixel sizes regardless of the minimum and maximum pixel size range of the locked rasters.
viewpt
optional point, used as view point for viewpoint mosaicking method
asc
optional bool, indicate whether to use ascending or descending order. Default is ascending order.
where
optional string. where clause to define a subset of rasters used in the mosaic, be aware that the rasters may not be visible at all scales
fids
optional list of objectids, use the raster id list to define a subset of rasters used in the mosaic, be aware that the rasters may not be visible at all scales.
muldidef
optional array. multidemensional definition used for filtering by variable/dimensions. See https://developers.arcgis.com/documentation/common-data-types/multidimensional-definition.htm
op
optional string, first,last,min,max,mean,blend,sum mosaic operation to resolve overlap pixel values: from first or last raster, use the min, max or mean of the pixel values, or blend them.
item_rendering_rule
optional item rendering rule, applied on items before mosaicking.
- Returns
a mosaic rule defined in the format at https://developers.arcgis.com/documentation/common-data-types/mosaic-rules.htm
Also see: Understanding the mosaicking rules for a mosaic dataset
-
property
mosaic_rule
¶ The mosaic rule used by the imagery layer to define:
The selection of rasters that will participate in the mosaic
The mosaic method, e.g. how the selected rasters are ordered.
The mosaic operation, e.g. how overlapping pixels at the same location are resolved.
Set by calling the mosaic_by or filter_by methods on the layer
-
property
multidimensional_info
¶ The multidimensional_info property returns multidimensional information of the Layer. This property is supported if the hasMultidimensions property of the Layer is true. Common data sources for multidimensional image services are mosaic datasets created from netCDF, GRIB, and HDF data.
-
property
pixel_type
¶ returns pixel type of the imagery layer
-
plot_histograms
(geometry=None, pixel_size=None, time=None, bands=[], display_stats=True, plot_properties=None, subplot_properties=None)¶ Image histograms visually summarize the distribution of a continuous numeric variable by measuring the frequency at which certain values appear in the image. The x-axis in the image histogram is a number line that displays the range of image pixel values that has been split into number ranges, or bins. A bar is drawn for each bin, and the width of the bar represents the density number range of the bin; the height of the bar represents the number of pixels that fall into that range. Understanding the distribution of your data is an important step in the data exploration process.
plot_histograms()
can be used for plotting the band-wise image histogram charts of any imagery layer published with mosaic datasets or a raster dataset.Arguments
Description
geometry
optional Polygon or Extent. A geometry that defines the geometry within which the histogram is computed. The geometry can be an envelope or a polygon. If not provided, then the full extent of the raster will be used for the computation.
pixel_size
optional string or dictionary. The pixel level being used (or the resolution being looked at). If pixel size is not specified, then pixel_size will default to the base resolution of the dataset. The structure of the pixel_size parameter is the same as the structure of the point object returned by the ArcGIS REST API. In addition to the dictionary structure, you can specify the pixel size with a comma-separated string.
- Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
time
optional datetime.date, datetime.datetime or timestamp string. The time instant or the time extent of the exported image. Time instant specified as datetime.date, datetime.datetime or timestamp in milliseconds since epoch Syntax: time=<timeInstant>
Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp
Available in 10.8+
bands
optional list of band indices. By default takes the first band (band index - 0). Image histogram charts are plotted for these specific bands.
- Example:
[0,2,3]
display_stats
optional boolean. Specifies whether to plot the band-wise statistics along with the histograms.
Some basic descriptive statistics are calculated and displayed on histograms. The mean and median are displayed with one line each, and one standard deviation above and below the mean is displayed using two lines.
False - The statistics will not be displayed along with the histograms.
True - The statistics will be displayed along with the histograms. This is the default.
plot_properties
optional dictionary. This parameter can be used to set the figure properties. These are the matplotlib.pyplot.figure() parameters and values specified in dict format.
- Example:
{“figsize”:(15,15)}
subplot_properties
optional list or dictionary. This parameter can be used to set band-wise histogram (subplot) display properties. These are the matplotlib.axes.Axes.bar() parameters and values specified in dictionary format.
- Example:
- [{“color”:”r”},{“color”:”g”},{“color”:”b”,”edgecolor”:”w”}]
Note: matplotlib.axes.Axes.bar() parameters: ‘’x’, ‘height’ or ‘align’ cannot be passed into subplot_properties.
Tip
When working with multidimensional imagery layers, you can use the multidimensional_filter() raster function on the layer for slicing the data along defined variables and dimensions. plot_histograms() can then be used on the output layer returned upon applying the filter.
- Returns
None
# Usage Example: Plots histograms of the raster with specified resolution and bands raster1.plot_histograms(pixel_size="0.18, 0.18", bands=[1, 2, 3])
-
project
(geometries, in_sr, out_sr)¶ The project operation is performed on an image layer method. This operation projects an array of input geometries from the input spatial reference to the output spatial reference. The response order of geometries is in the same order as they were requested.
Arguments
Description
geometries
required dictionary. The array of geometries to be projected.
in_sr
required string, dictionary, SpatialReference. The in_sr can accept a multitudes of values. These can be a WKID, image coordinate system (ICSID), or image coordinate system in json/dict format. Additionally the arcgis.geometry.SpatialReference object is also a valid entry.
Note
An image coordinate system ID can be specified using 0:icsid; for example, 0:64. The extra 0: is used to avoid conflicts with wkid
out_sr
required string, dictionary, SpatialReference. The in_sr can accept a multitudes of values. These can be a WKID, image coordinate system (ICSID), or image coordinate system in json/dict format. Additionally the arcgis.geometry.SpatialReference object is also a valid entry.
Note
An image coordinate system ID can be specified using 0:icsid; for example, 0:64. The extra 0: is used to avoid conflicts with wkid
- Returns
dictionary
-
property
properties
¶ The properties of this object
-
query
(where=None, out_fields='*', time_filter=None, geometry_filter=None, return_geometry=True, return_ids_only=False, return_count_only=False, pixel_size=None, order_by_fields=None, return_distinct_values=None, out_statistics=None, group_by_fields_for_statistics=None, out_sr=None, return_all_records=False, object_ids=None, multi_dimensional_def=None, result_offset=None, result_record_count=None, max_allowable_offset=None, true_curves=False, as_df=False, raster_query=None)¶ queries an imagery layer by applying the filter specified by the user. The result of this operation is either a set of features or an array of raster IDs (if return_ids_only is set to True), count (if return_count_only is set to True), or a set of field statistics (if out_statistics is used).
Arguments
Description
where
optional string. A where clause on this layer to filter the imagery layer by the selection sql statement. Any legal SQL where clause operating on the fields in the raster
out_fields
optional string. The attribute fields to return, comma-delimited list of field names.
time_filter
optional datetime.date, datetime.datetime or timestamp in milliseconds. The time instant or the time extent of the exported image.
Syntax: time_filter=<timeInstant>
Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time_filter=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp in milliseconds
geometry_filter
optional arcgis.geometry.filters. Spatial filter from arcgis.geometry.filters module to filter results by a spatial relationship with another geometry.
return_geometry
optional boolean. True means a geometry will be returned, else just the attributes
return_ids_only
optional boolean. False is default. True means only OBJECTIDs will be returned
return_count_only
optional boolean. If True, then an integer is returned only based on the sql statement
pixel_size
optional dict or string. Query visible rasters at a given pixel size. If pixel_size is not specified, rasters at all resolutions can be queried. Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
order_by_fields
optional string. Order results by one or more field names. Use ASC or DESC for ascending or descending order, respectively.
return_distinct_values
optional boolean. If true, returns distinct values based on the fields specified in out_fields. This parameter applies only if the supportsAdvancedQueries property of the image layer is true.
out_statistics
optional dict or string. The definitions for one or more field-based statistics to be calculated.
group_by_fields_for_statistics
optional dict/string. One or more field names using the values that need to be grouped for calculating the statistics.
out_sr
optional dict, SpatialReference. If the returning geometry needs to be in a different spatial reference, provide the function with the desired WKID.
return_all_records
optional boolean. If True(default) all records will be returned. False means only the limit of records will be returned.
object_ids
optional string. The object IDs of this raster catalog to be queried. When this parameter is specified, any other filter parameters (including where) are ignored. When this parameter is specified, setting return_ids_only=true is invalid. Syntax: objectIds=<objectId1>, <objectId2> Example: objectIds=37, 462
multi_dimensional_def
optional dict. The filters defined by multiple dimensional definitions.
result_offset
optional integer. This option fetches query results by skipping a specified number of records. The query results start from the next record (i.e., resultOffset + 1). The Default value is None.
result_record_count
optional integer. This option fetches query results up to the resultRecordCount specified. When resultOffset is specified and this parameter is not, image layer defaults to maxRecordCount. The maximum value for this parameter is the value of the layer’s maxRecordCount property. max_allowable_offset - This option can be used to specify the max_allowable_offset to be used for generalizing geometries returned by the query operation. The max_allowable_offset is in the units of the out_sr. If outSR is not specified, max_allowable_offset is assumed to be in the unit of the spatial reference of the Layer.
true_curves
optional boolean. If true, returns true curves in output geometries, otherwise curves get converted to densified polylines or polygons.
as_df
optional boolean. Returns the query result as a dataframe object
raster_query
optional string. Make query based on key properties of each raster catalog item. Any legal SQL where clause operating on the key properties of raster catalog items is allowed.
Example: LANDSAT_WRS_PATH >= 150 AND LANDSAT_WRS_PATH<= 165
This option was added at 10.8.1.
- Returns
A FeatureSet containing the footprints (features) matching the query when return_geometry is True, else a dictionary containing the expected return type.
-
query_boundary
(out_sr=None)¶ The Query Boundary operation is supported by image services based on mosaic datasets or raster datasets.
For an image service based on a mosaic dataset, the result of this operation includes the geometry shape of the mosaicked items’ boundary and area of coverage in square meters.
For an image service based on a raster dataset, the result of this operation includes the geometry shape of the dataset’s envelope boundary and area of coverage in square meters.
Added at 10.6
Argument
Description
out_sr
The spatial reference of the boundary’s geometry.
The spatial reference can be specified as either a well-known ID or as a spatial reference JSON object.
If the outSR is not specified, the boundary will be reported in the spatial reference of the image service.
- Example:
4326
- Returns
dictionary showing whether the specified rendering rule and/or mosaic rule is valid
-
property
raster_info
¶ Returns information about the ImageryLayer such as bandCount, extent , pixelSizeX, pixelSizeY, pixelType
-
property
rasters
¶ Raster manager for this layer
-
render_tilesonly_layer
(level=None, slice_id=None)¶ Render tiles only Imagery Layer at a given level.
Argument
Description
level
Optional integer. Level to be used for rendering. Default value is 0.
slice_id
Optional l integer. Renders the given slice of a multidimensional raster. To get the slice index use slices method on the ImageryLayer object.
- Returns
None
-
property
rows
¶ returns number of rows in the imagery layer
-
save
(output_name=None, for_viz=False, process_as_multidimensional=None, build_transpose=None, *, gis=None, future=False, **kwargs)¶ Persists this imagery layer to the GIS as an Imagery Layer item. If for_viz is True, a new Item is created that uses the applied raster functions for visualization at display resolution using on-the-fly image processing. If for_viz is False, distributed raster analysis is used for generating a new raster information product by applying raster functions at source resolution across the extent of the output imagery layer.
Argument
Description
output_name
Optional string. If not provided, an Imagery Layer item is created by the method and used as the output. You can pass in the name of the output Imagery Layer that should be created by this method to be used as the output for the tool. Alternatively, if for_viz is False, you can pass in an existing Image Layer Item from your GIS to use that instead. A RuntimeError is raised if a layer by that name already exists
for_viz
Optional boolean. If True, a new Item is created that uses the applied raster functions for visualization at display resolution using on-the-fly image processing. If for_viz is False, distributed raster analysis is used for generating a new raster information product for use in analysis and visualization by applying raster functions at source resolution across the extent of the output imagery layer.
process_as_multidimensional
Optional bool. If the input is multidimensional raster, the output will be processed as multidimensional if set to True
build_transpose
Optional bool, if set to true, transforms the output multidimensional raster. Valid only if process_as_multidimensional is set to True
gis
Optional arcgis.gis.GIS object. The GIS to be used for saving the output. Keyword only parameter.
future
Optional boolean. If True, the result will be a GPJob object and results will be returned asynchronously. Keyword only parameter.
tiles_only
In ArcGIS Online, the default output image service for this function would be a Tiled Imagery Layer.
To create Dynamic Imagery Layer as output on ArcGIS Online, set tiles_only parameter to False.
Function will not honor tiles_only parameter in ArcGIS Enterprise and will generate Dynamic Imagery Layer by default.
- Returns
output_raster - Image layer item
-
property
service
¶ The service backing this imagery layer (if user can administer the service)
-
set_filter
(where=None, geometry=None, time=None, lock_rasters=False, clear_filters=False)¶ Filters the rasters that will be used for applying raster functions.
If lock_rasters is set True, the LockRaster mosaic rule will be applied to the layer, unless overridden
Arguments
Description
where
optional string. A where clause on this layer to filter the imagery layer by the selection sql statement. Any legal SQL where clause operating on the fields in the raster
geometry
optional arcgis.geometry.filters. To filter results by a spatial relationship with another geometry
time
optional datetime, date, or timestamp. A temporal filter to this layer to filter the imagery layer by time using the specified time instant or the time extent.
Syntax: time_filter=<timeInstant>
Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time_filter=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp in milliseconds
lock_rasters
optional boolean. If True, the LockRaster mosaic rule will be applied to the layer, unless overridden
clear_filters
optional boolean. If True, the applied filters are cleared
-
slices
(muldidef=None)¶ Operation to query slice ID and multidimensional information of a multidimensional image service.
Operation available in ArcGIS Image Server 10.8.1 and higher.
Arguments
Description
muldidef
optional array. Multidimensional definition used for querying dimensional slices of the input image service.
Read more about Multidimensional definition here: https://developers.arcgis.com/documentation/common-data-types/multidimensional-definition.htm
# Usage Example: This example returns the slice ID and multidimensional information of slices with # "salinity" variable at "StdZ" dimension with a value of "-5000". multidimensional_definition = [{"variableName":"salinity","dimensionName":"StdZ","values":[-5000]}] multidimensional_lyr_input.slices(multidimensional_definition)
- Returns
dictionary containing the list of slice definitions.
-
statistics
(variable=None)¶ Returns statistics of the raster.
Operation available in ArcGIS Image Server 10.8.1 and higher.
Arguments
Description
variable
Optional string. For an image service that has multidimensional information, this parameter can be used to request statistics for each variable. If not specified, it will return statistics for the whole image service. Eligible variable names can be queried from multidimensional_info property of the Imagery Layer object.
# Usage Example: This example returns the statistics of an Imagery Layer object. lyr_input.statistics()
- Returns
dictionary containing the statistics.
-
sum
()¶ overlapping pixels at the same location are resolved by adding up all overlapping pixel values
- Returns
this imagery layer with mosaic operation set to ‘sum’
-
temporal_profile
(points=[], time_field=None, variables=[], bands=[0], time_extent=None, dimension=None, dimension_values=[], show_values=False, trend_type=None, trend_order=None, plot_properties={})¶ A temporal profile serves as a basic analysis tool for imagery data in a time series. Visualizing change over time with the temporal profile allows trends to be displayed and compared with variables, bands, or values from other dimensions simultaneously.
Using the functionality in temporal profile charts, you can perform trend analysis, gain insight into multidimensional raster data at given locations, and plot values that are changing over time in the form of a line graph.
Temporal profile charts can be used in various scientific applications involving time series analysis of raster data, and the graphical output of results can be used directly as input for strategy management and decision making.
The x-axis of the temporal profile displays the time in continuous time intervals. The time field is obtained from the timeInfo of the image service.
The y-axis of the temporal profile displays the variable value.
Argument
Description
points
Required list of point Geometry objects.
time_field
Required string. The time field that will be used for plotting temporal profile.
If not specified the time field is obtained from the timeInfo of the image service.
variables
Required list of variable names. For non multidimensional data, the variable would be name of the Sensor. To plot the graph against all sensors specify - “ALL_SENSORS”
bands
Optional list of band indices. By default takes the first band (band index - 0). For a multiband data, you can compare the time change of different bands over different locations.
time_extent
Optional list of date time object. This represents the time extent
dimension
Optional list of dimension names. This option works specifically on multidimensional data containing a time dimension and other dimensions.
The temporal profile is created based on the specific values in other dimensions, such as depth at the corresponding time value. For example, soil moisture data usually includes both a time dimension and vertical dimension below the earth’s surface, resulting in a temporal profile at 0.1, 0.2, and 0.3 meters below the ground.
dimension_values
Optional list of dimension values. This parameter can be used to specify the values of dimension parameter other than the time dimension (dimension name specified using dimension parameter)
show_values
Optional bool. Default False. Set this parameter to True to display the values at each point in the line graph.
trend_type
Optional string. Default None. Set the trend_type parameter eith with linear or harmonic to draw the trend line linear : Fits the pixel values for a variable along a linear trend line. harmonic : Fits the pixel values for a variable along a harmonic trend line.
trend_order
optional number. The frequency number to use in the trend fitting. This parameter specifies the frequency of cycles in a year. The default value is 1, or one harmonic cycle per year.
This parameter is only included in the trend analysis for a harmonic regression.
plot_properties
Optional dict. This parameter can be used to set the figure properties. These are the matplotlib.pyplot.figure() parameters and values specified in dict format.
eg: {“figsize”:(15,15)}
- Returns
None
-
property
tiles
¶ Imagery tile manager for this layer
-
property
tiles_only
¶ returns True if the layer is a Tiled Imagery Layer
-
to_features
(field='Value', output_type='Polygon', simplify=True, output_name=None, create_multipart_features=False, max_vertices_per_feature=None, *, gis=None, future=False, **kwargs)¶ Converts this raster to a persisted feature layer of the specified type using Raster Analytics.
Distributed raster analysis is used for generating a new feature layer by applying raster functions at source resolution across the extent of the raster and performing a raster to features conversion.
Argument
Description
field
Optional string - field that specifies which value will be used for the conversion. It can be any integer or a string field.
A field containing floating-point values can only be used if the output is to a point dataset.
Default is “Value”
output_type
Optional string.
One of the following: [‘Point’, ‘Line’, ‘Polygon’]
simplify
Optional bool, This option that specifies how the features should be smoothed. It is only available for line and polygon output.
True, then the features will be smoothed out. This is the default.
if False, then The features will follow exactly the cell boundaries of the raster dataset.
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
create_multipart_features
Optional boolean. Specifies whether the output polygons will consist of single-part or multipart features.
True: Specifies that multipart features will be created based on polygons that have the same value.
False: Specifies that individual features will be created for each polygon. This is the default.
max_vertices_per_feature
Optional int. The vertex limit used to subdivide a polygon into smaller polygons.
gis
Optional GIS object. If not speficied, the currently active connection is used.
future
Keyword only parameter. Optional boolean. If True, the result will be a GPJob object and results will be returned asynchronously.
- Returns
converted feature layer item
-
validate
(rendering_rule=None, mosaic_rule=None)¶ validates rendering rule and/or mosaic rule of an image service.
Argument
Description
rendering_rule
optional dictionary. Specifies the rendering rule to be validated
mosaic_rule
optional dictionary. Specifies the mosaic rule to be validated
- Returns
dictionary showing whether the specified rendering rule and/or mosaic rule is valid
-
property
width
¶ returns width of the imagery layer
-
ImageryLayerCacheManager¶
-
class
arcgis.raster.
ImageryLayerCacheManager
(url, gis=None, img_lyr=None)¶ Allows for administration of ArcGIS Online hosted image layers.
-
cancel_job
(job_id)¶ The cancel job operation supports cancelling a job while update tiles is running from a hosted feature service. The result of this operation is a response indicating success or failure with error code and description.
- Inputs:
job_id - job id to cancel
-
delete_tiles
(levels, extent=None)¶ Deletes tiles for the current cache
Argument
Description
extent
optional dictionary, If specified, the tiles within this extent will be deleted or will be deleted based on the service’s full extent.
- Example:
- 6224324.092137296,487347.5253569535,11473407.698535524,4239488.369818687the minx, miny, maxx, maxy values or,{“xmin”:6224324.092137296,”ymin”:487347.5253569535,“xmax”:11473407.698535524,”ymax”:4239488.369818687,“spatialReference”:{“wkid”:102100}} the JSONrepresentation of the Extent object.
levels
required string, The level to delete. Example, 0-5,10,11-20 or 1,2,3 or 0-5
- Returns
dictionary
-
edit_tile_service
(service_definition=None, min_scale=None, max_scale=None, source_item_id=None, export_tiles_allowed=False, max_export_tile_count=100000)¶ This operation updates a Tile Service’s properties
Argument
Description
service_definition
updates a service definition
min_scale
sets the services minimum scale for caching
max_scale
sets the service’s maximum scale for caching
source_item_id
The Source Item ID is the GeoWarehouse Item ID of the map service
export_tiles_allowed
sets the value to let users export tiles
max_export_tile_count
sets the maximum amount of tiles to be exported from a single call. Deletes tiles for the current cache
- Returns
boolean
-
classmethod
fromitem
(item)¶
-
import_tiles
(item, levels=None, extent=None, merge=False, replace=False)¶ Imports cache from a new ImageLayer Tile Package.
Argument
Description
item
Required ItemId or Item. The TPK file’s item id. This TPK file contains to-be-extracted bundle files which are then merged into an existing cache service.
levels
Optional String / List of integers, The level of details to update. Example: “1,2,10,20” or [1,2,10,20]
extent
Optional String / Dict. The area to update as Xmin, YMin, XMax, YMax example: “-100,-50,200,500” or {‘xmin’:100, ‘ymin’:200, ‘xmax’:105, ‘ymax’:205}
merge
Optional Boolean. Default is false and applicable to compact cache storage format. It controls whether the bundle files from the TPK file are merged with the one in the existing cached service. Otherwise, the bundle files are overwritten.
replace
Optional Boolean. Default is false, applicable to compact cache storage format and used when merge=true. It controls whether the new tiles will replace the existing ones when merging bundles.
- Returns
Dict
-
job_statistics
(job_id)¶ Returns the job statistics for the given job_id
Arguments
Description
job_id
required String. The unique identifier of the job in question.
- Returns
dict
-
job_status
(job_id)¶ Gets the Current Job Status
Arguments
Description
job_id
required String. The unique identifier of the job in question.
- Returns
dict
-
property
jobs
¶ returns a list of all the jobs on the tile server
-
property
properties
¶ The properties of this object
-
refresh
()¶ The refresh operation refreshes a service, which clears the web server cache for the service.
-
rerun_job
(job_id, code)¶ The rerun job operation supports re-running a canceled job from a hosted map service. The result of this operation is a response indicating success or failure with error code and description.
Argument
Description
code
required string, parameter used to re-run a given jobs with a specific error code: ALL | ERROR | CANCELED
job_id
required string, job to reprocess
- Returns
boolean or dictionary
-
update_tiles
(levels=None, extent=None, merge=False, replace=False)¶ Starts tile generation for ArcGIS Online. The levels of detail and the extent are needed to determine the area where tiles need to be rebuilt.
Argument
Description
levels
Optional String / List of integers, The level of details to update. Example: “1,2,10,20” or [1,2,10,20]
extent
Optional String / Dict. The area to update as Xmin, YMin, XMax, YMax example: “-100,-50,200,500” or {‘xmin’:100, ‘ymin’:200, ‘xmax’:105, ‘ymax’:205}
merge
Optional Boolean. Default is False. When true the updated cache is merged with the existing cache.
replace
Optional Boolean. The default is False. The updated tiles will remove the existing tiles.
- Returns
Dictionary. If the product is not ArcGIS Online tile service, the result will be None.
-
ImageryTileManager¶
-
class
arcgis.raster.
ImageryTileManager
(imglyr)¶ Manages the tiles for Cached Imagery Layers.
Note
This class is not created by users directly. An instance of this class, called tiles , is available as a property of an ImageryLayer object. Users call methods on this tiles object to create and access tiles from an ImageryLayer.
Argument
Description
imglyr
required ImageLayer. The imagery layer object that is cached.
-
estimate_size
(tile_package=False, extent=None, optimize_for_size=True, compression=75, export_by='LevelID', levels=None, aoi=None)¶ The estimate_size operation is an asynchronous task that allows estimation of the size of the tile package or the cache data set that you download using the Export Tiles operation. This operation can also be used to estimate the tile count in a tile package and determine if it will exceced the maxExportTileCount limit set by the administrator of the layer. The result of this operation is the response size. This job response contains reference to Image Layer Result method that returns the total size of the cache to be exported (in bytes) and the number of tiles that will be exported.
Argument
Description
tile_package
optional boolean. If the value is true output will be in tile package format and if the value is false Cache Raster data set is returned. The default value is false
extent
optional string. The extent (bounding box) of the tile package or the cache dataset to be exported. If extent does not include a spatial reference, the extent values are assumed to be in the spatial reference of the map. The default value is full extent of the tiled map service.
Syntax: <xmin>, <ymin>, <xmax>, <ymax> Example: -104,35.6,-94.32,41
optimize_for_size
optional boolean. Use this parameter to enable compression of JPEG tiles and reduce the size of the downloaded tile package or the cache raster data set. Compressing tiles slightly compromises on the quality of tiles but helps reduce the size of the download. Try out sample compressions to determine the optimal compression before using this feature.
compression
optional integer. When optimizeTilesForSize=true you can specify a compression factor. The value must be between 0 and 100. Default is 75.
export_by
optional string. The criteria that will be used to select the tile service levels to export. The values can be Level IDs, cache scales or the Resolution (in the case of image services). Values: LevelID,Resolution,Scale Default: LevelID
levels
optional string. Specify the tiled service levels to export. The values should correspond to Level IDs, cache scales or the Resolution as specified in exportBy parameter. The values can be comma separated values or a range.
Example 1: 1,2,3,4,5,6,7,8,9 Example 2: 1-4,7-9
aoi
optional polygon. The areaOfInterest polygon allows exporting tiles within the specified polygon areas. This parameter supersedes extent parameter.
- Returns
dictionary
-
export
(tile_package=False, extent=None, optimize_for_size=True, compression=75, export_by='LevelID', levels=None, aoi=None)¶ The export method allows client applications to download map tiles from server for offline use. This operation is performed on a Image Layer that allows clients to export cache tiles. The result of this operation is Image Layer Job.
export can be enabled in a layer by using ArcGIS Desktop or the ArcGIS Server Administrative Site Directory. In ArcGIS Desktop, make an admin or publisher connection to the server, go to layer properties and enable “Allow Clients to Export Cache Tiles” in advanced caching page of the layer Editor. You can also specify the maximum tiles clients will be allowed to download. The default maximum allowed tile count is 100,000. To enable this capability using the ArcGIS Servers Administrative Site Directory, edit the layer and set the properties exportTilesAllowed=true and maxExportTilesCount=100000.
Argument
Description
tile_package
optional boolean. Allows exporting either a tile package or a cache raster data set. If the value is true output will be in tile package format and if the value is false Cache Raster data set is returned. The default value is false
extent
optional string. The extent (bounding box) of the tile package or the cache dataset to be exported. If extent does not include a spatial reference, the extent values are assumed to be in the spatial reference of the map. The default value is full extent of the tiled map service.
Syntax: <xmin>, <ymin>, <xmax>, <ymax> Example: -104,35.6,-94.32,41
optimize_for_size
optional boolean. Use this parameter to enable compression of JPEG tiles and reduce the size of the downloaded tile package or the cache raster data set. Compressing tiles slightly compromises on the quality of tiles but helps reduce the size of the download. Try out sample compressions to determine the optimal compression before using this feature.
compression
optional integer. When optimizeTilesForSize=true you can specify a compression factor. The value must be between 0 and 100. Default is 75.
export_by
optional string. The criteria that will be used to select the tile service levels to export. The values can be Level IDs, cache scales or the Resolution (in the case of image services). Values: LevelID,Resolution,Scale Default: LevelID
levels
optional string. Specify the tiled service levels to export. The values should correspond to Level IDs, cache scales or the Resolution as specified in exportBy parameter. The values can be comma separated values or a range.
Example 1: 1,2,3,4,5,6,7,8,9 Example 2: 1-4,7-9
aoi
optional polygon. The areaOfInterest polygon allows exporting tiles within the specified polygon areas. This parameter supersedes extent parameter.
-
image_tile
(level, row, column, blank_tile=False)¶ For cached image services, this method represents a single cached tile for the image. The image bytes for the tile at the specified level, row, and column are directly streamed to the client. If the tile is not found, an HTTP status code of 404 .
Arguments
Description
level
required integer. The level of detail ID.
row
required integer. The row of the cache to pull from.
column
required integer. The column of the cache to pull from.
blank_tile
optional boolean. Default is False. This parameter applies only to cached image services that are configured with the ability to return blank or missing tiles for areas where cache is not available. When False, the server will return a resource not found (HTTP 404) response instead of a blank or missing tile. When this parameter is not set, the response will contain the header blank-tile : true for a blank/missing tile.
- Returns
None or file path (string)
-
Raster¶
-
class
arcgis.raster.
Raster
(path, is_multidimensional=False, extent=None, cmap=None, opacity=None, engine=None, gis=None)¶ A raster object is a variable that references a raster. It can be used to query the properties of the raster dataset.
Usage:
arcgis.raster.Raster(path, is_multidimensional=False, engine=None, gis=None)
The Raster class can work with arcpy engine or image server engine. By default, if the path is a local path, then the Raster class uses the arcpy engine else it will use image_server engine.
Argument
Description
path
Required string. The input raster.
- Example:
path = r”/path/to/raster”
path = “https://myserver/arcgis/rest/services/ImageServiceName/ImageServer”
path = “/fileShares/file_share_name/path/to/raster”
path = “/cloudStores/cloud_store_name/path/to/raster”
Note: When working with datastore rasters or non image service urls, RasterRendering service should be enabled in the active GIS connection
is_multidimensional
Optional boolean. Determines whether the input raster will be treated as multidimensional.
Specify True if the input is multidimensional and should be processed as multidimensional, where processing occurs for every slice in the dataset. Specify False if the input is not multidimensional, or if it is multidimensional and should not be processed as multidimensional.
Default is False
extent
Optional dict. If the input raster’s extent cannot be automatically inferred, pass in a dictionary representing the raster’s extent for when viewing on a
MapView
widget.- Example:
- { “xmin” : -74.22655,“ymin” : 40.712216,“xmax” : -74.12544,“ymax” : 40.773941,“spatialReference” :{ “wkid” : 4326 }}
cmap
Optional str. When displaying a 1 band raster in a
MapView
widget, what matplotlib colormap to apply to the raster. Seearcgis.mapping.symbol.display_colormaps()
for a list of compatible values.opacity
Optional number. When displaying a raster in a
MapView
widget, what opacity to apply. 0 is completely transparent, 1 is completely opaque. Default: 1engine
Optional string. The backend engine to be used. Possible options:
“arcpy” : Use the arcpy engine for processing.
“image_server” : Use the Image Server engine for processing.
gis
Optional. GIS of the Raster object.
# Example Usage map = gis.map() # Overlay an image service on the 'MapView' widget service_url = gis.content.search("my_image_service", item_type="Imagery Layer")[0].url raster = Raster(path=service_url, gis=gis) map.add_layer(raster) # Overlay .tif file present in user's registered fileShare datastore # (Requires RasterRendering service to be enabled in the active GIS) raster = Raster("/fileShares/data/Amberg.tif", gis=gis) map.add_layer(raster) # Overlay a publicly accesible Cloud-Optimized GeoTIFF # (Requires RasterRendering service to be enabled in the active GIS) raster = Raster("https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/43/M/BP/2021/6/S2A_43MBP_20210622_0_L2A/B08.tif", gis=gis) # Overlay a local .tif file raster = Raster(r"./data/Amberg.tif") map.add_layer(raster) # Overlay a 1-channel .gdb file with the "Orange Red" colormap at 85% opacity raster = Raster("./data/madison_wi.gdb/Impervious_Surfaces", cmap = "OrRd", opacity = 0.85) map.add_layer(raster) # Overlay a local .jpg file by manually specifying its extent raster = Raster("./data/newark_nj_1922.jpg", extent = {"xmin":-74.22655, "ymin":40.712216, "xmax":-74.12544, "ymax":40.773941, "spatialReference":{"wkid":4326}}) map.add_layer(raster)
-
property
RAT
¶ Return the attribute table as a dictionary if the table exists
-
add_dimension
(variable, new_dimension_name, dimension_value, dimension_attributes=None)¶ Adds a new dimension to a given variable.
(Operation is not supported on image services)
Argument
Description
variable
Required string. variable to which the new dimesnion is to be added
new_dimension_name
Required string. name of the new dimesnion to be added
dimension_value
Required string. dimension value
dimension_attributes
optional attributes of the new dimension like Description, Unit etc.
- Returns
The variable names and their dimensions in the multidimensional raster
# Usage Example: Adds a new dimension to the specified variable of multidimensional raster raster1 = Raster(r"/path/to/mult_dim.crf") raster1.add_dimension(variable="variable_name", new_dimension_name="new_dimension_name", dimension_value="dimension_value")
-
append_slices
(md_raster=None)¶ Appends the slices from another multidimensional raster.
(Operation is not supported on image services)
Arguments
Description
md_raster
Required multidimensional raster. The multidimensional raster containing the slices to be appended.
This raster must have the same variables, with the same dimension names, as the target raster. The cell sizes, extents, and spatial reference systems must also match.
The slices in this raster must be for dimension values that follow the dimension values of the slices in the target raster.
If a variable has two dimensions, slices will be appended along one dimension. The other dimension must have the same number of slices as the dimension in the target raster.
For example, if a salinity variable contains slices over time and depth dimensions, time slices can be appended to another salinity multidimensional raster but only if the same number of depth slices exist in both rasters.
- Returns (string)
A string containing the variable names and the associated dimensions in the multidimensional raster. For example, if the resulting raster has 10 time slices with precipitation data, it will return ‘prcp(StdTime=10)’.
# Usage Example: Append slices to target raster from source multidimensional raster target_raster.append_slices(md_raster=source_raster_obj)
-
property
band_count
¶ returns the band count of the raster
-
property
band_names
¶ returns the band names of the raster
-
property
block_size
¶ returns the block size of the raster
-
property
catalog_path
¶ The full path and the name of the referenced raster.
-
property
cmap
¶ When displaying a 1 band raster in a
MapView
widget, what matplotlib colormap to apply to the raster.Value must be a str. See
arcgis.mapping.symbol.display_colormaps()
for a list of compatible values.
-
property
columns
¶ returns number of columns in the raster
-
property
compression_type
¶ returns the compression type of the raster
-
draw_graph
(show_attributes=False, graph_size='14.25, 15.25')¶ Displays a structural representation of the function chain and it’s raster input values. If show_attributes is set to True, then the draw_graph function also displays the attributes of all the functions in the function chain, representing the rasters in a blue rectangular box, attributes in green rectangular box and the raster function names in yellow.
Argument
Description
show_attributes
optional boolean. If True, the graph displayed includes all the attributes of the function and not only it’s function name and raster inputs Set to False by default, to display only he raster function name and the raster inputs to it.
graph_size
optional string. Maximum width and height of drawing, in inches, seperated by a comma. If only a single number is given, this is used for both the width and the height. If defined and the drawing is larger than the given size, the drawing is uniformly scaled down so that it fits within the given size.
- Returns
Graph
# Usage Example 1: Draws the function chain applied on the Raster object created from an Image service. service_url = gis.content.search("my_image_service", item_type="Imagery Layer")[0].url raster = Raster(service_url, gis=gis) grayscale_raster = grayscale(raster=raster) invert_raster = boolean_not(rasters=[grayscale_raster]) invert_raster.draw_graph(show_attributes=True) # Usage Example 2: Draws the function chain applied on the Raster object created from local dataset raster = Raster(r"/path/to/raster") ndvi_raster = ndvi(raster=raster, band_indexes="5 6") ndvi_raster.draw_graph(show_attributes=True)
-
export_image
(bbox=None, image_sr=None, bbox_sr=None, size=None, time=None, export_format='jpgpng', pixel_type=None, no_data=None, no_data_interpretation='esriNoDataMatchAny', interpolation=None, compression=None, compression_quality=None, band_ids=None, mosaic_rule=None, rendering_rule=None, f='image', save_folder=None, save_file=None, compression_tolerance=None, adjust_aspect_ratio=None, lerc_version=None)¶ The export_image operation is performed on a raster layer to visualise it.
Arguments
Description
bbox
Optional dict or string. The extent (bounding box) of the exported image. Unless the bbox_sr parameter has been specified, the bbox is assumed to be in the spatial reference of the raster layer. The bbox should be specified as an arcgis.geometry.Envelope object, it’s json representation or as a list or string with this format: ‘<xmin>, <ymin>, <xmax>, <ymax>’ If omitted, the extent of the raster layer is used
image_sr
optional string, SpatialReference. The spatial reference of the exported image. The spatial reference can be specified as either a well-known ID, it’s json representation or as an arcgis.geometry.SpatialReference object. If the image_sr is not specified, the image will be exported in the spatial reference of the raster.
bbox_sr
optional string, SpatialReference. The spatial reference of the bbox. The spatial reference can be specified as either a well-known ID, it’s json representation or as an arcgis.geometry.SpatialReference object. If the image_sr is not specified, bbox is assumed to be in the spatial reference of the raster. (Available only when image_server engine is used)
size
optional list. The size (width * height) of the exported image in pixels. If size is not specified, an image with a default size of 400*450 will be exported. Syntax: list of [width, height]
time
optional datetime.date, datetime.datetime or timestamp string. The time instant or the time extent of the exported image. Time instant specified as datetime.date, datetime.datetime or timestamp in milliseconds since epoch Syntax: time=<timeInstant> Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp (Available only when image_server engine is used)
export_format
optional string. The format of the exported image. The default format is jpgpng. The jpgpng format returns a JPG if there are no transparent pixels in the requested extent; otherwise, it returns a PNG (png32). Values: jpgpng,png,png8,png24,jpg,bmp,gif,tiff,png32,bip,bsq,lerc
pixel_type
optional string. The pixel type, also known as data type, pertains to the type of values stored in the raster, such as signed integer, unsigned integer, or floating point. Integers are whole numbers, whereas floating points have decimals. (Available only when image_server engine is used)
no_data
optional float. The pixel value representing no information. (Available only when image_server engine is used)
no_data_interpretation
optional string. Interpretation of the no_data setting. The default is NoDataMatchAny when no_data is a number, and NoDataMatchAll when no_data is a comma-delimited string: NoDataMatchAny,NoDataMatchAll. (Available only when image_server engine is used)
interpolation
optional string. The resampling process of extrapolating the pixel values while transforming the raster dataset when it undergoes warping or when it changes coordinate space. One of: RSP_BilinearInterpolation, RSP_CubicConvolution, RSP_Majority, RSP_NearestNeighbor (Available only when image_server engine is used)
compression
optional string. Controls how to compress the image when exporting to TIFF format: None, JPEG, LZ77. It does not control compression on other formats. (Available only when image_server engine is used)
compression_quality
optional integer. Controls how much loss the image will be subjected to by the compression algorithm. Valid value ranges of compression quality are from 0 to 100. (Available only when image_server engine is used)
band_ids
optional list. If there are multiple bands, you can specify a single band to export, or you can change the band combination (red, green, blue) by specifying the band number. Band number is 0 based. Specified as list of ints, eg [2,1,0] (Available only when image_server engine is used)
mosaic_rule
optional dict. Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image layer will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue).
rendering_rule
optional dict. Specifies the rendering rule for how the requested image should be rendered.
f
optional string. The response format. default is json Values: json,image,kmz,numpy_array
Note: If f=”numpy_array” and if the raster is a single or multiband raster, the dimensions of the array will be rows, columns, and number of bands. If the raster is a multidimensional raster, the dimensions of the array will be number of slices, rows, columns, and number of bands. LERC needs to be installed to export image service as numpy array.
If f=”image”, the bytes of the exported image are returned unless save_folder and save_file parameters are also passed, in which case the image is written to the specified file (Available only when image_server engine is used)
save_folder
optional string. The folder in which the exported image is saved when f=image (Available only when image_server engine is used)
save_file
optional string. The file in which the exported image is saved when f=image (Available only when image_server engine is used)
compression_tolerance
optional float. Controls the tolerance of the lerc compression algorithm. The tolerance defines the maximum possible error of pixel values in the compressed image. Example: compression_tolerance=0.5 is loseless for 8 and 16 bit images, but has an accuracy of +-0.5 for floating point data. The compression tolerance works for the LERC format only. (Available only when image_server engine is used)
adjust_aspect_ratio
optional boolean. Indicates whether to adjust the aspect ratio or not. By default adjust_aspect_ratio is true, that means the actual bbox will be adjusted to match the width/height ratio of size paramter, and the response image has square pixels. (Available only when image_server engine is used)
lerc_version
optional integer. The version of the Lerc format if the user sets the format as lerc. Values: 1 or 2 If a version is specified, the server returns the matching version, or otherwise the highest version available. (Available only when image_server engine is used)
- Returns
The raw raster data
# Usage Example: Creates Raster object from a local dataset location and exports the image. raster_source = Raster(r"/path/to/raster") raster_source.export_image(size=[1000, 1000])
-
property
extent
¶ Area of interest. Used for displaying the imagery layer when queried
-
property
format
¶ returns the raster format
-
static
from_stac_item
(stac_item, request_params=None, engine=None, *, gis=None)¶ Create a Raster object from a SpatioTemporal Asset Catalog (STAC) Item.
Arguments
Description
stac_item
Required string or pystac.Item object. If string, then it should be the URL of the STAC item. It can be a Static STAC item URL or a STAC API Item URL.
Note: Currently only Landsat-8 STAC Items are supported for this method.request_params
Optional dictionary. This parameter can be used to set the properties for making the STAC Item request. These are the requests.get() method parameters and values will be specified in dictionary format.
This parameter is honoured when the stac_item parameter is set to a string (URL).- Example:
{“verify”:False}
engine
Optional string. The backend engine to be used for Raster processing.
- Possible options:
“arcpy” : Use the arcpy engine for processing.
“image_server” : Use the Image Server engine for processing (This is the default).
- Example:
“image_server”
Note: When using image_server engine, RasterRendering service should be enabled in the active GIS connection.
gis
Optional arcgis.gis.GIS object. The GIS of the Raster object.
- Returns
A Raster object
# Usage Example: Creating a Raster object from a STAC Item. ras = Raster.from_stac_item(stac_item=stac_item_url, gis=gis)
-
get_colormap
(variable_name=None)¶ Returns the color map of the raster. If the raster is multidimensional, returns the color map of a variable.
Argument
Description
variable_name
Optional string. The variable name of the multidimensional raster. If a variable is not specified and the raster is multidimensional, the color map of the first variable will be returned.
- Returns (dict)
The colormap of the raster or the given variable.
# Usage Example: Returns the colormap of specificied variable of a multidimensional raster raster1.get_colormap(variable_name="variable_name")
-
get_dimension_attributes
(variable_name, dimension_name)¶ Returns the attribute information of a dimension within a variable, e.g., min value, max value, unit, etc.
Arguments
Description
variable_name
required string. the name of the variable
dimension_name
required string. the name of the dimension
- Returns
dict. The attribute information of the given dimension within the given variable.
# Usage Example: Returns specified dimension attribute dictionary for given variable raster1.get_dimension_attributes(variable_name="variable_name", dimension_name="dimension_name")
-
get_dimension_names
(variable_name)¶ Returns a list of the dimension names that the variable contains.
Arguments
Description
variable_name
required string. the name of the variable
- Returns
list. The dimension names that the given variable contains
# Usage Example: Returns the list of the dimension names that the variable "variable_name" contains raster1.get_dimension_names(variable_name="variable_name")
-
get_dimension_values
(variable_name, dimension_name, return_as_datetime_object=False)¶ Returns a list of values along the given dimension within the given variable.
Argument
Description
variable_name
Required string. the name of the variable
dimension_name
Required string. the name of the dimension
return_as_datetime_object
Set to True, to return the dimension values as datetime object. Valid only if the dimension name is StdTime
- Returns
list. The dimension values along the given dimension within the given variable.
# Usage Example: Returns the values of a given dimension associated with the given variable. raster1.get_dimension_values(variable_name="variable_name", dimension_name="dimension_name")
-
get_histograms
(variable_name=None)¶ Returns the histograms of the raster. If the raster is multidimensional, it returns the histogram of a variable. If the raster is multiband, it returns the histogram of each band.
Argument
Description
variable_name
Optional string. The variable name of the multidimensional raster dataset. If a variable is not specified and the raster is multidimensional, the histogram of the first variable will be returned.
- Returns (list of dict)
The histogram values of the raster or variable.
# Usage Example: Returns the histograms of the raster raster1.get_histograms()
-
get_property
(property_name)¶ Returns the value of the given property.
Arguments
Description
property_name
required string. the name of the property
- Returns
string.
# Usage Example 1: Returns value of the property raster2.get_property(property_name="property_name")
-
get_raster_bands
(band_ids_or_names=None)¶ Returns a Raster object for each band specified in a multiband raster.
Arguments
Description
band_ids_or_names
required list. The index number or names of the bands to return as Raster objects. If not specified, all bands will be extracted.
- Returns
Raster object
# Usage Example: Generates the raster pertaining to the first band raster1 = Raster(r"./data/Amberg.tif") raster1.get_raster_bands(band_ids_or_names=[0])
-
get_statistics
(variable_name=None)¶ Returns the statistics of the raster. If the raster is multidimensional, returns the statistics of a variable.
Argument
Description
variable_name
Optional string. The variable name of the multidimensional raster dataset. If a variable is not specified and the raster is multidimensional, the statistics of the first variable will be returned.
- Returns (dict)
The statistics of the raster or the given variable.
# Usage Example: Returns the statistics of the raster raster1.get_statistics()
-
get_variable_attributes
(variable_name)¶ Returns the attribute information of a variable, e.g., description, unit, etc.
Arguments
Description
variable_name
required string. the name of the variable
- Returns
dict. The attribute information of the given variable.
# Usage Example: Returns variable attribute information raster1.get_variable_attributes(variable_name="variable_name")
-
property
has_RAT
¶ Identifies if there is an associated attribute table: True if an attribute table exists, or False if no attribute table exists.
-
property
height
¶ returns height of the raster in the units of its spatial reference
-
property
is_integer
¶ returns True if the raster has integer type.
-
property
is_multidimensional
¶ returns True if the raster is multidimensional.
-
property
is_temporary
¶ returns True if the raster is temporary, or False if it is permanent.
-
property
maximum
¶ returns the maximum value in the referenced raster.
-
property
mean
¶ returns the mean value in the referenced raster.
-
property
mean_cell_height
¶ returns the cell size in the y direction.
-
property
mean_cell_width
¶ returns the cell size in the x direction.
-
property
minimum
¶ returns minimum value in the referenced raster.
-
property
multidimensional_info
¶ returns the multidimensional information of the raster dataset, including variable names, descriptions and units, and dimension names, units, intervals, units, and ranges.
-
property
name
¶ returns the name of the raster
-
property
no_data_value
¶ returns the NoData value of the raster
-
property
no_data_values
¶ returns the NoData value for each band in the multiband raster
-
property
opacity
¶ When displaying in a
MapView
widget, what opacity to apply. 0 is completely transparent, 1 is completely opaque. Default: 1
-
property
path
¶ The full path and name of the referenced raster.
-
property
pixel_type
¶ returns pixel type of the imagery layer
-
plot_histograms
(geometry=None, pixel_size=None, time=None, bands=[], display_stats=True, plot_properties=None, subplot_properties=None)¶ Image histograms visually summarize the distribution of a continuous numeric variable by measuring the frequency at which certain values appear in the image. The x-axis in the image histogram is a number line that displays the range of image pixel values that has been split into number ranges, or bins. A bar is drawn for each bin, and the width of the bar represents the density number range of the bin; the height of the bar represents the number of pixels that fall into that range. Understanding the distribution of your data is an important step in the data exploration process.
plot_histograms()
can be used for plotting the band-wise image histogram charts of any Raster object.Arguments
Description
geometry
optional Polygon or Extent. A geometry that defines the geometry within which the histogram is computed. The geometry can be an envelope or a polygon. If not provided, then the full extent of the raster will be used for the computation.
Note: This parameter is honoured if the raster uses “image_server” engine.
pixel_size
optional string or dictionary. The pixel level being used (or the resolution being looked at). If pixel size is not specified, then pixel_size will default to the base resolution of the dataset. The structure of the pixel_size parameter is the same as the structure of the point object returned by the ArcGIS REST API. In addition to the dictionary structure, you can specify the pixel size with a comma-separated string.
Syntax: - dictionary structure: pixel_size={point} - Point simple syntax: pixel_size=’<x>,<y>’ Examples: - pixel_size={“x”: 0.18, “y”: 0.18} - pixel_size=’0.18,0.18’
Note: This parameter is honoured if the raster uses “image_server” engine.
time
optional datetime.date, datetime.datetime or timestamp string. The time instant or the time extent of the exported image. Time instant specified as datetime.date, datetime.datetime or timestamp in milliseconds since epoch Syntax: time=<timeInstant>
Time extent specified as list of [<startTime>, <endTime>] For time extents one of <startTime> or <endTime> could be None. A None value specified for start time or end time will represent infinity for start or end time respectively. Syntax: time=[<startTime>, <endTime>] ; specified as datetime.date, datetime.datetime or timestamp
Added at 10.8
Note: This parameter is honoured if the raster uses “image_server” engine.
bands
optional list of band indices. By default takes the first band (band index - 0). Image histogram charts are plotted for these specific bands.
- Example:
[0,2,3]
display_stats
optional boolean. Specifies whether to plot the band-wise statistics along with the histograms.
Some basic descriptive statistics are calculated and displayed on histograms. The mean and median are displayed with one line each, and one standard deviation above and below the mean is displayed using two lines.
False - The statistics will not be displayed along with the histograms.
True - The statistics will be displayed along with the histograms. This is the default.
plot_properties
optional dictionary. This parameter can be used to set the figure properties. These are the matplotlib.pyplot.figure() parameters and values specified in dict format.
- Example:
{“figsize”:(15,15)}
subplot_properties
optional list or dictionary. This parameter can be used to set band-wise histogram (subplot) display properties. These are the matplotlib.axes.Axes.bar() parameters and values specified in dictionary format.
- Example:
- [
{“color”:”r”},{“color”:”g”},{“color”:”b”,”edgecolor”:”w”}]
Note: matplotlib.axes.Axes.bar() parameters: ‘’x’, ‘height’ or ‘align’ cannot be passed into subplot_properties.
Tip
When working with multidimensional rasters, you can use the multidimensional_filter() raster function on the Raster object for slicing the data along defined variables and dimensions. plot_histograms() can then be used on the output raster returned upon applying the filter.
- Returns
None
# Usage Example: Plots histograms of the raster with specified resolution and bands raster1.plot_histograms(pixel_size="0.18, 0.18", bands=[1, 2, 3])
-
property
properties
¶ returns the property name and value pairs in the referenced raster
-
property
raster_info
¶ Returns information about the ImageryLayer such as bandCount, extent , pixelSizeX, pixelSizeY, pixelType
-
read
(upper_left_corner=(0, 0), origin_coordinate=None, ncols=0, nrows=0, nodata_to_value=None, cell_size=None)¶ read a numpy array from the calling raster
Arguments
Description
upper_left_corner
2-D tuple. a tuple with 2 values representing the number of pixels along x and y direction relative to the origin_coordinate. E.g., (2, 0), means that the real origin to extract the array is 2 pixels away in x direction from the origin_coordinate
origin_coordinate
2-d tuple (X, Y). The x and y values are in map units. If no value is specified, the top left corner of the calling raster,
ncols
integer. the number of columns from the real origin in the calling raster to convert to the NumPy array. If no value is specified, the number of columns of the calling raster will be used. Default: None
nrows
integer. the number of rows from the real origin in the calling raster to convert to the NumPy array. If no value is specified, the number of rows of the calling raster will be used. Default: None
nodata_to_value
numeric. pixels with nodata values in the raster would be assigned with the given value in the NumPy array. If no value is specified, the NoData value of the calling raster will be used. Default: None
cell_size
2-D tuple. a tuple with 2 values shows the x_cell_size and y_cell_size, e.g., cell_size = (2, 2). if no value is specified, the original cell size of the calling raster will be used. Otherwise, pixels would be resampled to the requested cell_size
- Returns
numpy.ndarray. If self is a multidimensional raster, the array has shape (slices, height, width, bands)
# Usage Example: Reads a numpy array from (2, 2) pixels away from the origin of the raster raster1.read(upper_left_corner=(2, 2))
-
property
read_only
¶ returns whether the raster cell values are writable or not using the [row, column] notation. When this property is True, they are not writable. Otherwise, they are writable.
-
remove_variables
(variable_names)¶ Removes the given variables.
(Operation is not supported on image services)
Arguments
Description
variable_names
required list. the list of variables to be removed
- Returns
list. a list of all variables.
# Usage Example: Removes specified variable and returns the list of remaining variables in the raster dataset. raster1.remove_variables(variable_names=["variable_name_1", "variable_name_2"])
-
rename_variable
(current_variable_name, new_variable_name)¶ Rename the given variable name.
(Operation is not supported on image services)
Argument
Description
current_variable_name
Required string. the name of the variable to be renamed
new_variable_name
Required string. the new variable name
- Returns
list. The dimension names that the given variable contains
# Usage Example: Rename variable name raster1.rename_variable(current_variable_name="current_variable_name", new_variable_name="new_variable_name")
-
property
rows
¶ returns number of rows in the raster
-
save
(output_name=None, for_viz=False, process_as_multidimensional=None, build_transpose=None, gis=None, future=False, **kwargs)¶ When run using image_server engine, save() persists this raster to the GIS as an Imagery Layer item. If for_viz is True, a new Item is created that uses the applied raster functions for visualization at display resolution using on-the-fly image processing. If for_viz is False, distributed raster analysis is used for generating a new raster information product by applying raster functions at source resolution across the extent of the output imagery layer.
When run using arcpy engine, save() Persists this raster to location specified in output_name.
Argument
Description
output_name
optional string.
When run using image_server engine, specify output name. If not provided, an Imagery Layer item is created by the method and used as the output. You can pass in the name of the output raster that should be created by this method to be used as the output for the tool. Alternatively, if for_viz is False, you can pass in an existing Image Layer Item from your GIS to use that instead. A RuntimeError is raised if a layer by that name already exists
When run using arcpy engine, output_name is the name string representing the output location.
for_viz
optional boolean. If True, a new Item is created that uses the applied raster functions for visualization at display resolution using on-the-fly image processing. If for_viz is False, distributed raster analysis is used for generating a new raster information product for use in analysis and visualization by applying raster functions at source resolution across the extent of the output raster.
(Available only when image_server engine is used)
process_as_multidimensional
Optional bool. If the input is multidimensional raster, the output will be processed as multidimensional if set to True
build_transpose
Optional bool, if set to true, transforms the output multidimensional raster. Valid only if process_as_multidimensional is set to True
gis
optional arcgis.gis.GIS object. The GIS to be used for saving the output. Keyword only parameter.
(Available only when image_server engine is used)
future
Optional boolean. If True, the result will be a GPJob object and results will be returned asynchronously. Keyword only parameter.
(Available only when image_server engine is used)
tiles_only
In ArcGIS Online, the default output image service for this function would be a Tiled Imagery Layer.
To create Dynamic Imagery Layer as output on ArcGIS Online, set tiles_only parameter to False.
Function will not honor tiles_only parameter in ArcGIS Enterprise and will generate Dynamic Imagery Layer by default.
(Available only when image_server engine is used)
- Returns
String representing the location of the output data
# Usage Example 1: Saves the local raster output to a new location (usecase for arcpy engine rasters) raster1.save(output_name=r"/path/to/output_location/raster.crf", process_as_multidimensional=True) # Usage Example 2: Saves the raster to the active GIS as an Imagery Layer Item (usecase for image_server engine rasters) raster2.save(output_name="output_imagery_layer_name", gis=gis)
-
set_colormap
(color_map, variable_name=None)¶ Sets the color map for the raster. If the raster is multidimensional, it sets the color map for a variable.
(Operation is not supported on image services)
Argument
Description
color_map
Optional (string, dict): The color map to apply to the raster. This can be a string indicating the name of the color map or color ramp to use, for example, NDVI or Yellow To Red, respectively. This can also be a Python dictionary with a custom color map or color ramp object.
For example:
customized colormap object, e.g., {‘values’: [0, 1, 2, 3, 4, 5, 6], ‘colors’: [‘#000000’, ‘#DCFFDF’, ‘#B8FFBE’, ‘#85FF90’, ‘#50FF60’,’#00AB10’, ‘#006B0A’]}
colorramp name, e.g., “Yellow To Red”
colormap name, e.g., “NDVI”
customized colorramp object, e.g., {“type”: “algorithmic”, “fromColor”: [115, 76, 0, 255],”toColor”: [255, 25, 86, 255], “algorithm”: “esriHSVAlgorithm”}
variable_name
Optional string. The variable name of the multidimensional raster dataset. If a variable is not specified and the raster is multidimensional, the color map of the first variable will be set.
- Returns
None
# Usage Example: Sets "NDVI" color map for the raster raster1.set_colormap(color_map="NDVI")
-
set_engine
(engine)¶ Can be used to change the back end engine
-
set_histograms
(histogram_obj, variable_name=None)¶ Set the histogram for the raster or a given variable if the raster is multidimensional.
(Operation is not supported on image services)
Argument
Description
histogram_obj
Optional list of histogram objects(dict),
If the raster is multiband, the histogram for each band will be set with each dictionary in the list. The first band will use the histogram in the first dictionary. The second band will use the histogram in the second dictionary, and so on.
size - The number of bins in the histogram
min - The minimum pixel value
max - The maximum pixel value
counts - A list containing the number of pixels in each bin, in the order of bins
For example:
[{‘size’: number_of_bins, ‘min’: min_val, ‘max’: max_val, ‘counts’: [pixel_count_at_each_bin, …]}, …]
variable_name
Optional string. The variable name of the multidimensional raster dataset. If a variable is not specified and the raster is multidimensional, the histogram will be set for the first variable.
- Returns
None
# Usage Example: Sets specified histograms for the raster raster1.set_histograms(histogram_obj=[{"size": number_of_bins, "min": min_val, "max": max_val, "counts": [pixel_count_at_each_bin]}])
-
set_property
(property_name, property_value)¶ Add a customized property to the raster. If the property name exists, the existing property value will be overwritten.
(Operation is not supported on image services)
Arguments
Description
property_name
required string. The property name of the raster
property_value
required string. The value to assign to the property.
- Returns
None
# Usage Example: Add user-defined property name and value to raster raster1.set_property(property_name="property_name", property_value="property_value")
-
set_statistics
(statistics_obj, variable_name=None)¶ Sets the statistics for the raster. If the raster is multiband, it sets the statistics for each band. If the raster is multidimensional, it sets the statistics for a variable.
(Operation is not supported on image services)
Argument
Description
statistics_obj
Optional list of statistics objects. A list of Python dictionaries containing statistics and corresponding values to set. For example, [{‘min’: 10, ‘max’: 20}] sets the minimum and maximum pixel values.
If the raster is multiband, the statistics for each band will be set with each dictionary in the list. The first band will use the statistics in the first dictionary. The second band will use the statistics in the second dictionary, and so on.
min - The minimum pixel value max - The maximum pixel value mean - The mean pixel value median - The median pixel value standardDeviation - The standard deviation of the pixel values count - The total number of pixels skipX - The horizontal skip factor skipY - The vertical skip factor
For example:
[{‘min’: val, ‘max’: val, ‘mean’: val, ‘standardDeviation’: val, ‘median’: val, ‘mode’: val, ‘count’: val}, …]
variable_name
Optional string. The variable name of the multidimensional raster. If a variable is not specified and the raster is multidimensional, the statistics of the first variable will be set.
- Returns
None
# Usage Example: Sets statistics of the raster raster1.set_statistics(statistics_obj=[{"min": val, "max": val, "mean": val, "standardDeviation": val}], variable_name="variable_name")
-
set_variable_attributes
(variable_name, variable_attributes)¶ Sets the attribute information of a variable in a multidimensional raster (for example, description, unit, and so on).
(Operation is not supported on image services)
Arguments
Description
variable_name
Required string. The variable name of the multidimensional raster dataset.
variable_attributes
Required dict that contains attribute information to replace the current attribute information of the variable.
For example:
{“Description”: “Daily total precipitation”, “Unit”: “mm/day”}.
- Returns (dict)
The attribute information of the variable.
# Usage Example: Sets variable attributes to the specified variable raster1.set_variable_attributes(variable_name="variable_name", variable_attributes={"attribute_1": "value_1", "attribute_2": "value_2"})
-
property
slices
¶ returns the attribute information of each slice, including its variable name, dimension names, and dimension values returned as a list of dictionaries.
-
property
spatial_reference
¶ returns the spatial reference of the referenced raster.
-
property
standard_deviation
¶ returns the standard deviation of the values in the referenced raster.
-
summarize
(geometry, pixel_size=None)¶ The result of this operation contains statistics of a Raster for a given geometry.
Argument
Description
geometry
Required Polygon or Extent. A geometry that defines the geometry within which the histogram is computed. The geometry can be an envelope or a polygon
pixel_size
optional string or dict. The pixel level being used (or the resolution being looked at). If pixel size is not specified, then pixel_size will default to the base resolution of the dataset. The raster at the specified pixel size in the mosaic dataset will be used for histogram calculation.
- Syntax:
dictionary structure: pixel_size={point}
Point simple syntax: pixel_size=’<x>,<y>’
- Examples:
pixel_size={“x”: 0.18, “y”: 0.18}
pixel_size=’0.18,0.18’
- Returns
dictionary. (Dictionary at each index represents the statistics of the corresponding band.)
[{“min”: 0,”max”: 9,”mean”: 3.271703916996627,”standardDeviation”: 1.961013669880657,”median”: 4,”mode”: 4,”skipX”: 1,”skipY”: 1,”count”: 2004546}]
# Usage Example: Summarize a raster at an area. stats = raster.summarize(geometry=geom_obj) mean_of_first_band = stats[0]["mean"]
-
property
uncompressed_size
¶ returns the size of the referenced raster dataset on disk.
-
property
variable_names
¶ returns the variable names in the multidimensional raster
-
property
variables
¶ returns the variable names and their dimensions in the multidimensional raster dataset. For example, a multidimensional raster containing temperature data over 24 months would return the following: [‘temp(StdTime=24)’]
-
property
vmax
¶ When displaying a 1 band raster with the cmap argument specified on a MapView, vmin and vmax define the data range that the colormap covers. This property is the upper end of that range.
-
property
vmin
¶ When displaying a 1 band raster with the cmap argument specified on a MapView, vmin and vmax define the data range that the colormap covers. This property is the lower end of that range.
-
property
width
¶ returns width of the raster in the units of its spatial reference
-
write
(array, upper_left_corner=(0, 0), origin_coordinate=None, value_to_nodata=None)¶ write a numpy array to the calling raster.
(Operation is not supported on image services)
Arguments
Description
array
required numpy.ndarray. the array must be in the shape of (slices, height, width, bands) for writing a multidimensional raster and (height, width bands) for writing a normal raster
upper_left_corner
2-D tuple.a tuple with 2 values representing the number of pixels along x and y direction that shows the position relative to the origin_coordinate. E.g., (2, 0), means that the position from which the numpy array will be written into the calling Raster is 2 pixels away in x direction from the origin_coordinate. Default value is (0, 0)
origin_coordinate
2-d tuple (X, Y) from where the numpy array will be written into the calling Raster. The x- and y-values are in map units. If no value is specified, the top left corner of the calling raster,
value_to_nodata
numeric. The value in the numpy array assigned to be the NoData values in the calling Raster.
If no value is specified, the NoData value of the calling Raster will be used. Default None
- Returns
None
# Usage Example: Write a numpy array (2, 2) pixels away from the origin to the raster raster1.write(upper_left_corner=(2, 2))
RasterCatalogItem¶
-
class
arcgis.raster.
RasterCatalogItem
(url, imglyr, initialize=True)¶ Represents a single catalog item on an Image Layer. This class is only to be used with Imagery Layer objects that have ‘Catalog’ in the layer’s capabilities property.
Argument
Description
url
required string. Web address to the catalog item.
imglyr
required ImageryLayer. The imagery layer object.
initialize
optional boolean. Default is true. If false, the properties of the item will not be loaded until requested.
-
property
ics
¶ The raster ics property returns the image coordinate system of the associated raster in an image layer. The returned ics can be used as the SR parameter.
-
property
ics_to_pixel
¶ returns coefficients to build up mathematic model for geometric transformation. With this transformation, ICS coordinates based from the catalog item raster can be used to calculate the original column and row numbers on the corresponding image.
-
image
(bbox, return_format='JSON', bbox_sr=None, size=None, image_sr=None, image_format='png', pixel_type=None, no_data=None, interpolation=None, compression=75)¶ The image() method returns a composite image for a single raster catalog item. You can use this method for generating dynamic images based on a single catalog item. This method provides information about the exported image, such as its URL, width and height, and extent. Apart from the usual response formats of html and json, you can also request a format called image for the image. When you specify image as the format, the server responds by directly streaming the image bytes to the client. With this approach, you don’t get any information associated with the image other than the actual image.
Arguments
Description
return_format
optional string. The response can either be IMAGER or JSON. Image will return the image file to disk where as the JSON value will The default value is JSON.
bbox
required string. The extent (bounding box) of the exported image. Unless the bbox_sr parameter has been specified, the bbox is assumed to be in the spatial reference of the image layer. Syntax: <xmin>, <ymin>, <xmax>, <ymax> Example: bbox=-104,35.6,-94.32,41
bbox_sr
optional string. The spatial reference of the bbox.
size
optional string.The size (width * height) of the exported image in pixels. If the size is not specified, an image with a default size of 400 * 400 will be exported. Syntax: <width>, <height> Example: size=600,550
image_sr
optional string/integer. The spatial reference of the image.
format
optional string. The format of the exported image. The default format is png. Values: png, png8, png24, jpg, bmp, gif
pixel_type
optional string. The pixel type, also known as data type, that pertains to the type of values stored in the raster, such as signed integer, unsigned integer, or floating point. Integers are whole numbers; floating points have decimals. Values: C128, C64, F32, F64, S16, S32, S8, U1, U16, U2, U32, U4, U8, UNKNOWN
no_data
optional float. The pixel value representing no information.
interpolation
optional string. The resampling process of extrapolating the pixel values while transforming the raster dataset when it undergoes warping or when it changes coordinate space. Values: RSP_BilinearInterpolation, RSP_CubicConvolution, RSP_Majority, RSP_NearestNeighbor
compression
optional integer. Controls how much loss the image will be subjected to by the compression algorithm. Valid value ranges of compression quality are from 0 to 100.
-
property
info
¶ The info property returns information about the associated raster such as its width, height, number of bands, and pixel type.
-
property
key_properties
¶ The raster key_properties property returns key properties of the associated raster in an image layer.
-
property
metadata
¶ The metadata property returns metadata of the image layer or a raster catalog item. The output format is always XML.
-
property
properties
¶ returns the object properties
-
property
thumbnail
¶ returns a thumbnail of the current item
-
property
RasterManager¶
-
class
arcgis.raster.
RasterManager
(imglyr)¶ This class allows users to update, add, and delete rasters to an ImageryLayer object. The functions are only available if the layer has ‘Edit’ on it’s capabilities property.
Note
This class is not created by users directly. An instance of this class, called rasters , is available as a property of an ImageryLayer object. Users call methods on this rasters object to update, add and delete rasters from an ImageryLayer
Argument
Description
imglyr
required ImageryLayer. The imagery layer object where ‘Edit’ is in the capabilities.
-
add
(raster_type, item_ids=None, service_url=None, compute_statistics=False, build_pyramids=False, build_thumbnail=False, minimum_cell_size_factor=None, maximum_cell_size_factor=None, attributes=None, geodata_transforms=None, geodata_transform_apply_method='esriGeodataTransformApplyAppend')¶ This operation is supported at 10.1 and later. The Add Rasters operation is performed on an image layer method. The Add Rasters operation adds new rasters to an image layer (POST only). The added rasters can either be uploaded items, using the item_ids parameter, or published services, using the service_url parameter. If item_ids is specified, uploaded rasters are copied to the image Layer’s dynamic image workspace location; if the service_url is specified, the image layer adds the URL to the mosaic dataset no raster files are copied. The service_url is required input for the following raster types: Image Layer, Map Service, WCS, and WMS.
Arguments
Description
item_ids
The upload items (raster files) to be added. Either item_ids or service_url is needed to perform this operation.
Syntax:
item_ids=<itemId1>,<itemId2>
Example:
item_ids=ib740c7bb-e5d0-4156-9cea-12fa7d3a472c, ib740c7bb-e2d0-4106-9fea-12fa7d3a482c
service_url
The URL of the service to be added. The image layer will add this URL to the mosaic dataset. Either item_ids or service_url is needed to perform this operation. The service URL is required for the following raster types: Image Layer, Map Service, WCS, and WMS.
Example:
service_url= http://myserver/arcgis/services/Portland/ImageServer
raster_type
The type of raster files being added. Raster types define the metadata and processing template for raster files to be added. Allowed values are listed in image layer resource.
Example:
Raster Dataset, CADRG/ECRG, CIB,DTED, Image Layer, Map Service, NITF, WCS, WMS
compute_statistics
If true, statistics for the rasters will be computed. The default is false.
Values:
false,true
build_pyramids
If true, builds pyramids for the rasters. The default is false.
Values:
false,true
build_thumbnail
If true, generates a thumbnail for the rasters. The default is false.
Values:
false,true
minimum_cell_size_factor
The factor (times raster resolution) used to populate the MinPS field (maximum cell size above which the raster is visible).
Syntax:
minimum_cell_size_factor=<minimum_cell_size_factor>
Example:
minimum_cell_size_factor=0.1
maximum_cell_size_factor
The factor (times raster resolution) used to populate MaxPS field (maximum cell size below which raster is visible).
Syntax:
maximum_cell_size_factor=<maximum_cell_size_factor>
Example:
maximum_cell_size_factor=10
attributes
Any attribute for the added rasters.
Syntax:
{“<name1>” : <value1>,“<name2>” : <value2>}Example:
{“MinPS”: 0,“MaxPS”: 20;“Year” : 2002,“State” : “Florida”}geodata_transforms
The geodata transformations applied on the added rasters. A geodata transformation is a mathematical model that performs a geometric transformation on a raster; it defines how the pixels will be transformed when displayed or accessed. Polynomial, projective, identity, and other transformations are available. The geodata transformations are applied to the dataset that is added.
Syntax:
[{“geodataTransform” : “<geodataTransformName1>”,“geodataTransformArguments” : {<geodataTransformArguments1>}},{“geodataTransform” : “<geodataTransformName2>”,“geodataTransformArguments” : {<geodataTransformArguments2>}}]The syntax of the geodataTransformArguments property varies based on the specified geodataTransform name. See Geodata Transformations documentation for more details.
geodata_transform_apply_method
This parameter defines how to apply the provided geodataTransform. The default is esriGeodataTransformApplyAppend.
Values:
esriGeodataTransformApplyAppend | esriGeodataTransformApplyReplace | esriGeodataTransformApplyOverwrite
- Returns
dictionary
-
delete
(raster_ids)¶ The Delete Rasters operation deletes one or more rasters in an image layer.
Argument
Description
raster_ids
required string. The object IDs of a raster catalog items to be removed. This is a comma seperated string.
example 1: raster_ids=’1,2,3,4’ # Multiple IDsexample 2: raster_ids=’10’ # single ID- Returns
dictionary
-
update
(raster_id, files=None, item_ids=None, service_url=None, compute_statistics=False, build_pyramids=False, build_thumbnail=False, minimum_cell_size_factor=None, maximum_cell_size_factor=None, attributes=None, footprint=None, geodata_transforms=None, apply_method='esriGeodataTransformApplyAppend')¶ The Update Raster operation updates rasters (attributes and footprints, or replaces existing raster files) in an image layer. In most cases, this operation is used to update attributes or footprints of existing rasters in an image layer. In cases where the original raster needs to be replaced, the new raster can either be items uploaded using the items parameter or URLs of published services using the serviceUrl parameter.
Argument
Description
raster_ids
required integer. The object IDs of a raster catalog items to be updated.
files
optional list. Local source location to the raster to replace the dataset with. Example: [r”<path>data.tiff”]
item_ids
optional string. The uploaded items (raster files) being used to replace existing raster.
service_url
optional string. The URL of the layer to be uploaded to replace existing raster data. The image layer will add this URL to the mosaic dataset. The serviceUrl is required for the following raster types: Image Layer, Map Service, WCS, and WMS.
compute_statistics
If true, statistics for the uploaded raster will be computed. The default is false.
build_pyramids
optional boolean. If true, builds pyramids for the uploaded raster. The default is false.
build_thumbnail
optional boolean. If true, generates a thumbnail for the uploaded raster. The default is false.
minimum_cell_size_factor
optional float. The factor (times raster resolution) used to populate MinPS field (minimum cell size above which raster is visible).
maximum_cell_size_factor
optional float. The factor (times raster resolution) used to populate MaxPS field (maximum cell size below which raster is visible).
footprint
optional Polygon. A JSON 2D polygon object that defines the footprint of the raster. If the spatial reference is not defined, it will default to the image layer’s spatial reference.
attributes
optional dictionary. Any attribute for the uploaded raster.
geodata_transforms
optional string. The geodata transformations applied on the updated rasters. A geodata transformation is a mathematical model that performs geometric transformation on a raster. It defines how the pixels will be transformed when displayed or accessed, such as polynomial, projective, or identity transformations. The geodata transformations will be applied to the updated dataset.
apply_method
optional string. Defines how to apply the provided geodataTransform. The default is esriGeodataTransformApplyAppend.
Values: esriGeodataTransformApplyAppend, esriGeodataTransformApplyReplace, esriGeodataTransformApplyOverwrite
- Returns
dictionary
-
RasterCollection¶
-
class
arcgis.raster.
RasterCollection
(rasters=None, attribute_dict=None, where_clause=None, query_geometry=None, engine=None, gis=None, context=None)¶ The RasterCollection object allows a group of rasters to be sorted and filtered easily, and prepares a collection for additional processing and analysis.
Argument
Description
rasters
The input raster datasets. Supported inputs include a list of local or datastore rasters, a mosaic dataset, a multidimensional raster in Cloud Raster Format, a NetCDF file, or an image service. If you’re using a list of raster datasets, all rasters must have the same cell size and spatial reference.
arcpy should be available if the input is a local raster dataset.
attribute_dict
Optional dict. attribute information to be added to each raster, when the input is a list of rasters. For each key-value pair, the key is the attribute name and the value is a list of values that represent the attribute value for each raster. For example, to add a name field to a list of three rasters, use {“name”: [“Landsat8_Jan”, “Landsat8_Feb”, “Landsat8_Mar”]}.
where_clause
Optional string. An expression that limits the records returned.
query_geometry
Optional. An object that filters the items such that only those that intersect with the object will be returned.
engine
Optional string. The backend engine to be used. Possible options:
“arcpy” : Use the arcpy engine for processing.
“image_server” : Use the Image Server engine for processing.
gis
Optional GIS of the RasterCollection object.
context
Optional. Additional properties to control the creation of RasterCollection. The context parameter would be honoured by all other collections created from this i.e., the map/filter outputs. The filter/map methods also support the context parameter which can be configured separately for each method.
Currently available:
query_boundary: The boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
By default, query_boundary is set to True, i.e, SHAPE field will be added.
Example: {“query_boundary”:True}
# Usage Example 1: Creates a raster collection from image service url service_url = gis.content.search('my_rasters', item_type="Imagery Layer")[0].url rc = RasterCollection(rasters=service_url, gis=gis)
# Usage Example 2: Creates a raster collection from rasters stored locally ras1 = Raster(r"./data/ras1.tif") ras2 = Raster(r"./data/ras2.tif") ras3 = Raster(r"./data/ras3.tif") ras_list = [ras1, ras2, ras3] # Add attributes to the raster collection acquisition_date = ["2016-01-01T00:00:00", "2016-02-01T00:00:00", "2016-03-01T00:00:00"] name_list = ["Landsat8_Jan", "Landsat8_Feb", "Landsat8_Mar"] rc = RasterCollection(rasters=ras_list, attribute_dict={"name": name_list, "AcquisitionDate": acquisition_date} )
-
property
count
¶ returns the count of items in the RasterCollection
-
property
fields
¶ returns the fields available in the RasterCollection
-
filter_by
(where_clause=None, query_geometry_or_extent=None, raster_query=None, context=None)¶ filter a raster collection based on attribute and/or spatial queries
Argument
Description
where_clause
Optional String. An SQL expression used to select a subset of rasters
query_geometry_or_extent
Optional Geometry object. Items in the collection that fails to intersect the given geometry will be excluded
raster_query
Optional string. An SQL expression used to select a subset of rasters by the raster’s key properties.
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a RasterCollection object that only contains items sastisfying the queries
# Usage Example: Creates a Raster collection and filters rasters satisfying the raster query. service_url = gis.content.search('my_image_service')[0].url rc = RasterCollecton(service_url, gis=gis) filtered_rc = rc.filter_by(raster_query="raster_query")
-
filter_by_attribute
(field_name, operator, field_values, context=None)¶ Filters the collection of raster items by an attribute query and returns a raster collection containing only the items that satisfy the query.
Argument
Description
field_name
Required string. The field name to use in the filter.
operator
Required string. The keyword to filter the attributes. Keywords include the following:
CONTAINS - The attribute in the field contains the specified string, list, or number.
ENDS_WITH - The attribute ends with the specified string or number.
EQUALS - The attribute equals the specified string, list, or number.
GREATER_THAN - The attribute is greater than the specified number.
IN - The attribute is one of the items in the specified list.
LESS_THAN - The attribute is less than the specified number.
NOT_CONTAINS - The attribute does not contain the specified string, list, or number.
NOT_ENDS_WITH - The attribute does not end with the specified string or number.
NOT_EQUALS - The attribute does not equal the specified string, list, or number.
NOT_GREATER_THAN - The attribute is not greater than the specified number.
NOT_IN - The attribute is not one of the items in the specified list.
NOT_LESS_THAN - The attribute is not less than the specified number.
NOT_STARTS_WITH - The attribute does not start with the specified string or number.
STARTS_WITH - The attribute starts with the specified string or number.
field_values
Required object. The attribute value or values against which to compare. This can be specified as a string, a list, or a number.
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a RasterCollection object that only contains items sastisfying the filter
# Usage Example 1: Filters the raster collection based on matching field name. filtered_rc_attribute = rc.filter_by_attribute(field_name="Name", operator="EQUALS", field_values="field_values") # Usage Example 2: Filters the raster collection based on unmatching field name. filtered_rc_attribute2 = rc.filter_by_attribute(field_name="Name", operator="NOT_EQUALS", field_values="field_values")
-
filter_by_calendar_range
(calendar_field, start, end=None, time_field_name='StdTime', date_time_format=None, context=None)¶ filter the raster collection by a calendar_field and its start and end value (inclusive). i.e. if you would like to select all the rasters that have the time stamp on Monday, specify calendar_field as ‘DAY_OF_WEEK’ and put start and end to 1.
Argument
Description
calendar_field
Required String, one of ‘YEAR’, ‘MONTH’, ‘QUARTER’, ‘WEEK_OF_YEAR’, ‘DAY_OF_YEAR’, ‘DAY_OF_MONTH’, ‘DAY_OF_WEEK’, ‘HOUR’
start
Required integer. The start value of the calendar_field. For example, to filter all items that were collected in January,
filtered_rc = rc.filter_by_calendar_range(calendar_field=”MONTH”, start=1).
end
Optional integer.
The end value of the calendar_field. For example, to filter all items that were collected in the first 5 days of each year,
filtered_rc = rc.filter_by_calendar_range(calendar_field=”DAY_OF_YEAR”, start=1, end=5)
time_field_name
Optional string. The name of the field that contains the time attribute for each item in the collection. The default is StdTime.
date_time_format
Optional string. The time format of the values in the time field. For example, if the input time value is “1990-01-31”, the date_time_format is “%Y-%m-%d”.
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a RasterCollection object that only contains items sastisfying the filter
# Usage Example 1: Filters the raster collection to hold rasters from the month of January. filtered_rc_month = rc2.filter_by_calendar_range(calendar_field="MONTH", start=1) # Usage Example 2: Filter the raster collection over the years 2015-2020. filtered_rc_years = rc2.filter_by_calendar_range(calendar_field="YEAR", start=2015, end=2020)
-
filter_by_geometry
(query_geometry_or_extent, context=None)¶ Filters the collection of raster items so that only those that intersect with the geometry will be returned.
Argument
Description
query_geometry_or_extent
Required object that filters the items such that only those that intersect with the object will be returned. This can be specified with a Geometry object, Raster object, ImageryLayer object.
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a RasterCollection object that only contains items sastisfying the filter
# Usage Example: Filters the raster collection based on specified geometry. aoi = { "spatialReference": {"wkid": 32610}, "xmax": 725000, "xmin": 720000, "ymax": 4300000, "ymin": 4250000, } aoi_geometry = Geometry(aoi) filtered_rc_geom = rc.filter_by_geometry(query_geometry_or_extent=aoi_geometry)
-
filter_by_raster_property
(property_name, operator, property_values, context=None)¶ Filters the collection of raster items by a raster property query and returns a raster collection containing only the items that satisfy the query.
Argument
Description
property_name
Required string. The name of the property to use in the filter.
operator
Required string. The keyword to filter the attributes. Keywords include the following:
CONTAINS - The attribute in the field contains the specified string, list, or number.
ENDS_WITH - The attribute ends with the specified string or number.
EQUALS - The attribute equals the specified string, list, or number.
GREATER_THAN - The attribute is greater than the specified number.
IN - The attribute is one of the items in the specified list.
LESS_THAN - The attribute is less than the specified number.
NOT_CONTAINS - The attribute does not contain the specified string, list, or number.
NOT_ENDS_WITH - The attribute does not end with the specified string or number.
NOT_EQUALS - The attribute does not equal the specified string, list, or number.
NOT_GREATER_THAN - The attribute is not greater than the specified number.
NOT_IN - The attribute is not one of the items in the specified list.
NOT_LESS_THAN - The attribute is not less than the specified number.
NOT_STARTS_WITH - The attribute does not start with the specified string or number.
STARTS_WITH - The attribute starts with the specified string or number.
property_values
Required object. The property value or values against which to compare.
This can be specified as a string, a list, or a number.
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a RasterCollection object that only contains items sastisfying the filter
# Usage Example: Filters out rasters with a band count of 3 from the raster collection filtered_rc = rc.filter_by_raster_property(property_name="BAND_COUNT", operator="EQUALS", property_values=3)
-
filter_by_time
(start_time='', end_time='', time_field_name='StdTime', date_time_format=None, context=None)¶ filter a raster collection by time
Argument
Description
start_time
Optional String representation of the start time.
end_time
Optional String representation of the end time.
time_field_name
Optional string. the name of the field containing the time information for each item. Default: “StdTime”
date_time_format
Optional string. the time format that is used to format the time field values. Please ref the python date time standard for this argument (See this).
Default is None and this means using the Pro standard time format ‘%Y-%m-%dT%H:%M:%S’ and ignoring the following sub-second.
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a RasterCollection object that only contains items sastisfying the filter
# Usage Example: Filters the raster collection based on time parameters. filtered_rc_time = rc.filter_by_time(start_time="1990-01-01 00:00:00", end_time="1999-12-31 00:00:00", time_field_name="AcquisitionDate")
-
static
from_stac_api
(stac_api, query=None, attribute_dict=None, request_method='POST', request_params=None, engine=None, *, gis=None)¶ Create a RasterCollection object from a SpatioTemporal Asset Catalog (STAC) API search query.
Arguments
Description
stac_api
Required string. URL of the STAC API root endpoint. The STAC API where the search needs to be performed.
Note: Currently only Landsat-8 STAC Item queries are supported for this method.query
Optional dictionary. The GET/POST request query dictionary that can be used to query a STAC API’s search endpoint. (keys/values would depend on the specification of the STAC API in use and the request_method parameter value).
For the “bbox” query parameter, arcgis.geometry.Envelope and arcgis.geometry.Polygon objects are also accepted (in any spatial reference).
- Example:
- {“collections”: [“landsat-8-l1-c1”],“bbox”: [-110,39.5,-105,40.5],“query”: {“eo:cloud_cover”: {“lt”: 30}},“datetime”: “2020-10-05T00:00:00Z/2020-10-18T12:31:12Z”,“limit”: 10}
attribute_dict
Optional dictionary. The attribute information to be added to each (STAC Item) raster returned from the query. For each key-value pair, the key is the attribute name, and the value is a list of values that represent the attribute value for each raster.
Attribute values can also be collected from the STAC Items automatically using the STAC Item metadata information. It can be done by specifying the STAC Item property name for the Attribute of interest in this format:
key : value -> Attribute display name : STAC item property name
- Example:
- {“Name”:”id”,“Sensor”:”platform”,“StdTime”:”datetime”,“Cloud Cover”:”eo:cloud_cover”,“Extent”:”bbox”}
Note: If ‘Geometry’ is not specified in the attribute_dict then it would be automatically added for each Raster in the RasterCollection based on its STAC Item ‘geometry’ property and would be in Spatial reference:
{'wkid':4326}
.request_method
Optional string. The HTTP request method used with the STAC API for making the search.
Acceptable methods:
GET
POST (This is the default)
- Example:
“POST”
request_params
This parameter can be used to set the properties for making the STAC API search request. These are the requests.post() or requests.get() method parameters and values will be specified in dictionary format.
- Example:
- {“verify”:True,“headers”:{“Authorization”: “Bearer access_token_string”}}
engine
Optional string. The backend engine to be used for Raster processing.
- Possible options:
“arcpy” : Use the arcpy engine for processing.
“image_server” : Use the Image Server engine for processing (This is the default).
- Example:
“image_server”
Note: When using image_server engine, RasterRendering service should be enabled in the active GIS connection.
gis
Optional arcgis.gis.GIS object. The GIS of the RasterCollection object.
- Returns
A RasterCollection object
# Usage Example: Creating a RasterCollection object from making a query to a STAC API. rc = RasterCollection.from_stac_api(stac_api=stac_api_url, query={ "collections": ["landsat-8-l1-c1"], "bbox": [-110,39.5,-105,40.5], "query": {"eo:cloud_cover": {"lt": 30}}, "datetime": "2020-10-05T00:00:00Z/2020-10-18T12:31:12Z", "limit": 10 }, attribute_dict={ "Name":"id", "Sensor":"platform", "StdTime":"datetime", "Cloud Cover":"eo:cloud_cover", "Spatial Reference":"proj:epsg", "Extent":"bbox" }, request_method="POST", gis=gis)
-
static
from_stac_catalog
(stac_catalog, attribute_dict=None, request_params=None, engine=None, *, gis=None)¶ Create a RasterCollection object from a Static SpatioTemporal Asset Catalog (STAC).
Arguments
Description
stac_catalog
Required string or pystac.Catalog object. If string, then it should be the URL of the Static STAC (Catalog).
Note: Currently only Landsat-8 STAC (Catalogs) are supported for this method.attribute_dict
Optional dictionary. The attribute information to be added to each (STAC Item) raster of the catalog. For each key-value pair, the key is the attribute name, and the value is a list of values that represent the attribute value for each raster.
Attribute values can also be collected from the STAC Items automatically using the STAC Item metadata information. It can be done by specifying the STAC Item property name for the Attribute of interest in this format:
key : value -> Attribute display name : STAC item property name
- Example:
- {“Name”:”id”,“Sensor”:”platform”,“StdTime”:”datetime”,“Cloud Cover”:”eo:cloud_cover”,“Extent”:”bbox”}
Note: If ‘Geometry’ is not specified in the attribute_dict then it would be automatically added for each Raster in the RasterCollection based on its STAC Item ‘geometry’ property and would be in Spatial reference:
{'wkid':4326}
.request_params
Optional dictionary. This parameter can be used to set the properties for making the STAC Item/Catalog requests. These are the requests.get() method method parameters and values will be specified in dictionary format.
This parameter is honoured when the stac_catalog parameter is set to a string (URL).- Example:
{“verify”:False}
engine
Optional string. The backend engine to be used for Raster processing.
- Possible options:
“arcpy” : Use the arcpy engine for processing.
“image_server” : Use the Image Server engine for processing (This is the default).
- Example:
“image_server”
Note: When using image_server engine, RasterRendering service should be enabled in the active GIS connection.
gis
Optional arcgis.gis.GIS object. The GIS of the RasterCollection object.
- Returns
A RasterCollection object
# Usage Example: Creating a RasterCollection object from a Static STAC. rc = RasterCollection.from_stac_catalog(stac_catalog=stac_catalog_url, attribute_dict={ "Name":"id", "Sensor":"collection", "StdTime":"datetime", "Cloud Cover":"eo:cloud_cover", "Extent":"bbox" }, gis=gis)
-
get_field_values
(field_name, max_count=0)¶ Returns the values of a specified field from the raster collection.
Argument
Description
field_name
Required string. The name of the field from which to extract values.
max_count
Optional integer. An integer that specifies the maximum number of field values to be returned. The values will be returned in the order that the raster items are ordered in the collection. If no value is specified, all the field values for the given field will be returned.
- Returns
a list of values of the specified field from the raster collection.
-
majority
(ignore_nodata=True)¶ Returns a raster object in which each band contains the pixel value that occurs most frequently for that band across all rasters in the raster collection.
For example, if there are ten raster items in the raster collection, each with four bands, the majority method will determine the pixel value that occurs most frequently across all raster items for band 1, for band 2, for band 3, and for band 4; a four-band raster is returned. Band numbers are matched between raster items using the band index, so the items in the raster collection must follow the same band order.
Argument
Description
ignore_nodata
Optional Boolean. Specifies whether NoData values are ignored.
True : The method will include all valid pixels and ignore any NoData pixels. This is the default.
False : The method will result in NoData if there are any NoData values.
- Returns
a Raster object
-
map
(func, context=None)¶ Maps a Python function over a raster collection.
Argument
Description
func
Required. The Python function to map over the raster collection. The return value of the function must be a dictionary in which one of the keys is raster. For example, {“raster”: output_raster_object, “name”: input_item_name[“name”]}.
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a new RasterCollection created from the existing RasterCollection after applying the func on each item.
# Usage Example: This snippet maps grayscale function to each raster item in the raster collection. rc_local = RasterCollection(r"./data/rasters.gdb/rasters") def grayscale(item): raster = item["Raster"] gray = grayscale(raster) return {"Raster": gray, "Name": item["Name"], "StdTime": item["AcquisitionDate"]} gray_rc = rc_local.map(grayscale)
-
max
(ignore_nodata=True)¶ Returns a raster object in which each band contains the maximum pixel values for that band across all rasters in the raster collection.
For example, if there are ten raster items in the raster collection, each with four bands, the max method will calculate the maximum pixel value that occurs across all raster items for band 1, band 2, band 3, and band 4; a four-band raster is returned. Band numbers are matched between raster items using the band index, so the items in the raster collection must follow the same band order.
Argument
Description
ignore_nodata
Optional Boolean. Specifies whether NoData values are ignored.
True : The method will include all valid pixels and ignore any NoData pixels. This is the default.
False : The method will result in NoData if there are any NoData values.
- Returns
a Raster object
-
mean
(ignore_nodata=True)¶ Returns a raster object in which each band contains the average pixel values for that band across all rasters in the raster collection.
For example, if there are ten raster items in the raster collection, each with four bands, the mean method will calculate the mean pixel value that occurs across all raster items for band 1, for band 2, for band 3, and for band 4; a four-band raster is returned. Band numbers are matched between raster items using the band index, so the items in the raster collection must follow the same band order.
Argument
Description
ignore_nodata
Optional Boolean. Specifies whether NoData values are ignored.
True : The method will include all valid pixels and ignore any NoData pixels. This is the default.
False : The method will result in NoData if there are any NoData values.
- Returns
a Raster object
-
median
(ignore_nodata=True)¶ Returns a raster object in which each band contains the median pixel values for that band across all rasters in the raster collection.
For example, if there are ten raster items in the raster collection, each with four bands, the median method will calculate the median pixel value that occurs across all raster items for band 1, for band 2, for band 3, and for band 4; a four-band raster is returned. Band numbers are matched between raster items using the band index, so the items in the raster collection must follow the same band order.
Argument
Description
ignore_nodata
Optional Boolean. Specifies whether NoData values are ignored.
True : The method will include all valid pixels and ignore any NoData pixels. This is the default.
False : The method will result in NoData if there are any NoData values.
- Returns
a Raster object
-
min
(ignore_nodata=True)¶ Returns a raster object in which each band contains the minimum pixel values for that band across all rasters in the raster collection.
For example, if there are ten raster items in the raster collection, each with four bands, the min method will calculate the minimum pixel value that occurs across all raster items for band 1, band 2, band 3, and band 4; a four-band raster is returned. Band numbers are matched between raster items using the band index, so the items in the raster collection must follow the same band order.
Argument
Description
ignore_nodata
Optional Boolean. Specifies whether NoData values are ignored.
True : The method will include all valid pixels and ignore any NoData pixels. This is the default.
False : The method will result in NoData if there are any NoData values.
- Returns
a Raster object
-
mosaic
(mosaic_method='FIRST')¶ Returns a Raster object in which all items in a raster collection have been mosaicked into a single raster.
Argument
Description
mosaic_method
Optional string. The method used to handle overlapping areas between adjacent raster items. Mosaic method options include the following:
FIRST - Determines the pixel value from the first raster that is overlapping.
LAST - Determines the pixel value from the last raster that is overlapping.
MEAN - Determines the average pixel value from the two rasters that are overlapping.
MIN - Determines the lower pixel value from the two raster datasets that are overlapping.
MAX - Determines the higher pixel value from the two raster datasets that are overlapping.
SUM - Determines the sum of pixel values from the two rasters that are overlapping.
(The default value is FIRST)
- Returns
a Raster object
-
quality_mosaic
(quality_rc_or_list, statistic_type=None)¶ Returns a Raster object in which all items in a raster collection have been mosaicked into a single raster based on a quality requirement.
Argument
Description
quality_rc_or_list
Required. The raster collection or list of rasters to be used as quality indicators.
For example, Landsat 8’s Band 1 is the Coastal/Aerosol band, which can be used to estimate the concentration of fine aerosol particles such as smoke and haze in the atmosphere. For a collection of Landsat 8 images, use the select_bands method to return a RasterCollection object containing only Band 1 from each raster item. The number of raster items in the quality_rc_or_list must match the number of raster items in the raster collection to be mosaicked.
statistic_type
Required string. The statistic used to compare the input collection or list of quality rasters.
MAX - The highest pixel value in the input quality rasters will be the pixel value in the output raster. This is the default.
MEDIAN - The median pixel value in the input quality rasters will be the pixel value in the output raster.
MIN - The minimum pixel value in the input quality rasters will be the pixel value in the output raster.
For example, to mosaic the input raster collection such that those with the lowest aerosol content are on top, use the MIN statistic type.
- Returns
a Raster object
-
select_bands
(band_ids_or_names, context=None)¶ Selects a list of bands from every raster item in a raster collection and returns a raster collection that contains raster items with only the selected bands.
Argument
Description
band_ids_or_names
Required. The names or index numbers of bands to be included in the returned raster items. This can be specified with a single string, integer, or a list of strings or integers.
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a RasterCollection that contains raster items with only the selected bands.
-
set_engine
(engine)¶ Can be used to change the back end engine
-
sort
(field_name, ascending=True, context=None)¶ Sorts the collection of rasters by a field name and returns a raster collection that is in the order specified.
Argument
Description
field_name
Required string. The name of the field to use for sorting.
ascending
Optional bool. Specifies whether to sort in ascending or descending order. (The default value is True)
context
Optional dictionary. Additional properties to control the creation of RasterCollection. The default value for the context parameter would be the same as that of the context settings applied to the parent collection.
Currently available:
query_boundary: This boolean value set to this option determines whether to add SHAPE field to the RasterCollection. The value in the SHAPE field represents the boundary/geometry of the raster. The query_boundary parameter is honoured only when the RasterCollection is created from a list of Rasters.
True: Set query_boundary to True to add the SHAPE field to the RasterCollection.
False: Set query_boundary to False to not add the SHAPE field to the RasterCollection. (Creation of RasterCollection would be faster)
Example:
{“query_boundary”:True}
- Returns
a sorted RasterCollection object
-
sum
(ignore_nodata=True)¶ Returns a raster object in which each band contains the sum of pixel values for that band across all rasters in the raster collection.
For example, if there are ten raster items in the raster collection, each with four bands, the sum method will calculate the sum of pixel values for each pixel that occurs across all raster items for band 1, band 2, band 3, and band 4; a four-band raster is returned. Band numbers are matched between raster items using the band index, so the items in the raster collection must follow the same band order.
Argument
Description
ignore_nodata
Optional Boolean. Specifies whether NoData values are ignored.
True : The method will include all valid pixels and ignore any NoData pixels. This is the default.
False : The method will result in NoData if there are any NoData values.
- Returns
a Raster object
-
to_multidimensional_raster
(variable_field_name, dimension_field_names)¶ Returns a multidimensional raster dataset, in which each item in the raster collection is a slice in the multidimensional raster.
Argument
Description
variable_field_name
Required string. The name of the field that contains the variable names.
dimension_field_names
Required string. The name of the field or fields that contains the dimension names. This can be specified as a single string or a list of strings.
For time-related dimensions, the field name must match one of the following to be recognized as a time field: StdTime, Date, Time, or AcquisitionDate. For nontime-related dimensions, the values in those fields must be type Double. If there are two or more dimensions, use a comma to separate the fields (for example, dimension_field_names = [“Time”, “Depth”]).
- Returns
a Raster object
# Usage Example: Generates a multidimensional raster from the raster collection. multidim_raster = rc.to_multidimensional_raster(variable_field_name="Name", dimension_field_name="AcquisitionDate")
RasterInfo¶
-
class
arcgis.raster.
RasterInfo
(raster_info_dict=None)¶ Class allows to create RasterInfo object that describes a set of raster properties to facilitate the creation of local raster dataset using the Raster class (requires arcpy)
A RasterInfo object can be created by instantiating it from a dictionary, or by calling an Imagery Layer/Raster object’s raster_info property
Information about the raster can also be set through the following properties available on the RasterInfo object: band_count, extent , pixel_size_x, pixel_size_y, pixel_type, block_height, block_width, no_data_values, spatial_reference
To construct RasterInfo object from a dictionary, use from_dict method on this class.
# Usage Example 1: This example creates a new Raster object from the raster_info of another Raster object. (requires arcpy) raster_obj = Raster(<raster dataset path>) ras_info = RasterInfo(raster_obj.raster_info) rinfo_based_ras = Raster(rasInfo2) #To write pixel values to this temporary Raster object: rinfo_based_ras.write(<numpy_array>) #To save this temporary raster locally: rinfo_based_ras.save(r"C:\data\persisted_raster.crf")
RasterInfo object can also be used in raster functions that take in raster info as a parameter. (does not require arcpy) example: As value to the raster_info parameter for arcgis.raster.functions.constant_raster() and arcgis.raster.functions.random_raster()
-
property
band_count
¶ Information about the band count of a raster.
-
property
block_height
¶ Information about the block height
-
property
block_width
¶ Information about the block width
-
property
extent
¶ Information about the extent of a raster.
-
from_dict
(raster_info_dict)¶ Function used to initialise RasterInfo object from raster info dictionary
# Usage Example : rinfo = RasterInfo() rinfo.from_dict({'bandCount': 3, 'extent': {"xmin": 4488761.95, "ymin": 5478609.805, "xmax": 4489727.05, "ymax": 5479555.305, "spatialReference": { "wkt": "PROJCS["Deutsches_Hauptdreiecksnetz_Transverse_Mercator", GEOGCS["GCS_Deutsches_Hauptdreiecksnetz",DATUM["D_Deutsches_Hauptdreiecksnetz", SPHEROID["Bessel_1841",6377397.155,299.1528128]],PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"], PARAMETER["false_easting",4500000.0],PARAMETER["false_northing",0.0], PARAMETER["central_meridian",12.0],PARAMETER["scale_factor",1.0], PARAMETER["latitude_of_origin",0.0],UNIT["Meter",1.0]]" }}, 'pixelSizeX': 0.0999999999999614, 'pixelSizeY': 0.1, 'pixelType': 'U8'})
-
property
no_data_values
¶ Information about the no_data_values
-
property
pixel_size_x
¶ Information about the pixel size of a raster in x direction
-
property
pixel_size_y
¶ Information about the pixel size of a raster in y direction
-
property
pixel_type
¶ Information about the pixel type of a raster.
-
property
spatial_reference
¶ Information about the extent of a raster.
-
to_dict
()¶ To return Raster Info in dictionary format
-
property
Submodules¶
- arcgis.raster.analytics module
- get_datastores
- is_supported
- generate_raster
- interpolate_points
- create_viewshed
- summarize_raster_within
- calculate_density
- classify
- segment
- train_classifier
- convert_feature_to_raster
- convert_raster_to_feature
- copy_raster
- create_image_collection
- add_image
- delete_image
- delete_image_collection
- list_datastore_content
- build_footprints
- build_overview
- calculate_statistics
- optimum_travel_cost_network
- determine_travel_costpath_as_polyline
- generate_multidimensional_anomaly
- build_multidimensional_transpose
- aggregate_multidimensional_raster
- generate_trend_raster
- predict_using_trend_raster
- find_argument_statistics
- linear_spectral_unmixing
- subset_multidimensional_raster
- costpath_as_polyline
- define_nodata
- optimal_path_as_line
- optimal_region_connections
- analyze_changes_using_ccdc
- detect_change_using_change_analysis_raster
- manage_multidimensional_raster
- sample
- merge_multidimensional_rasters
- analyze_changes_using_landtrendr
- zonal_statistics_as_table
- compute_change_raster
- arcgis.raster.functions module
- abs
- acos
- acosh
- aggregate
- aggregate_cells
- apparent_reflectance
- apply
- arg_max
- arg_median
- arg_min
- arg_statistics
- arithmetic
- asin
- asinh
- aspect
- aspect_slope
- atan
- atan2
- atanh
- bai
- band_arithmetic
- bitwise_and
- bitwise_left_shift
- bitwise_not
- bitwise_or
- bitwise_right_shift
- bitwise_xor
- boolean_and
- boolean_not
- boolean_or
- boolean_xor
- buffered
- cire
- cig
- classify
- clay_minerals
- clip
- colormap
- colormap_to_rgb
- colorspace_conversion
- complex
- composite_band
- compute_change
- con
- constant_raster
- contour
- contrast_brightness
- convolution
- cos
- cosh
- curvature
- detect_change_using_change_analysis_raster
- divide
- duration
- elevation_void_fill
- equal_to
- evi
- exp
- exp10
- exp2
- expression
- extract_band
- ferrous_minerals
- FLOAT
- float_divide
- floor_divide
- focal_stats
- gemi
- generate_trend
- geometric
- gndvi
- grayscale
- greater_than
- greater_than_equal
- gvitm
- heat_index
- hillshade
- identity
- INT
- interpolate_irregular_data
- iron_oxide
- is_null
- less_than
- less_than_equal
- linear_spectral_unmixing
- ln
- local
- log10
- log2
- lookup
- majority
- mask
- max
- mean
- med
- min
- minority
- minus
- ml_classify
- mndwi
- mod
- monitor_vegetation
- msavi
- mtvi2
- multidimensional_filter
- nbr
- ndbi
- ndmi
- ndsi
- ndvi
- ndvire
- NDVI
- ndwi
- negate
- not_equal
- pansharpen
- plus
- power
- predict_using_trend
- pvi
- cellstats_range
- random_raster
- raster_calculator
- raster_collection_function
- rasterize_features
- remap
- reproject
- resample
- round_down
- round_up
- rtvi_core
- s1_radiometric_calibration
- s1_thermal_noise_removal
- savi
- segment_mean_shift
- set_null
- shaded_relief
- sin
- sinh
- slope
- spectral_conversion
- speckle
- sqrt
- square
- sr
- srre
- focal_statistics
- statistics_histogram
- std
- stretch
- sultan
- sum
- tan
- tanh
- tasseled_cap
- threshold
- times
- transpose_bits
- trend_to_rgb
- tsavi
- unit_conversion
- vari
- variety
- vector_field
- vector_field_renderer
- weighted_overlay
- weighted_sum
- wind_chill
- arcgis.raster.functions.gbl module
- boundary_clean
- calculate_distance
- calculate_travel_cost
- corridor
- cost_allocation
- cost_backlink
- cost_distance
- cost_path
- distance_accumulation
- distance_allocation
- euclidean_allocation
- euclidean_back_direction
- euclidean_direction
- euclidean_distance
- expand
- fill
- flow_accumulation
- flow_direction
- flow_distance
- flow_length
- kernel_density
- least_cost_path
- nibble
- optimal_path_as_raster
- path_distance
- path_distance_allocation
- path_distance_back_link
- region_group
- shrink
- sink
- snap_pour_point
- stream_link
- stream_order
- viewshed
- watershed
- zonal_statistics
- arcgis.raster.orthomapping module
- is_supported
- compute_sensor_model
- alter_processing_states
- get_processing_states
- match_control_points
- color_correction
- compute_control_points
- compute_seamlines
- edit_control_points
- generate_dem
- generate_orthomosaic
- generate_report
- query_camera_info
- query_control_points
- reset_image_collection
- compute_spatial_reference_factory_code
- arcgis.raster.functions.RFT
- arcgis.raster.utils module