Skip to content

Anatomy of Python Raster Type

Karishma Chandnani edited this page May 8, 2019 · 4 revisions

In this chapter, the details of implementing a raster type in a Python module are described. A Raster Type is a layer that facilitates the interaction with the application on aspects of the data as described in the introduction. Raster types are also core to adding rasters to a mosaic dataset (using the Add Rasters to a Mosaic Dataset Geoprocessing tool).

The ArcGIS framework identifies raster types by using the well-known Factory pattern. A Raster Type Factory holds a collection of raster types - the collection can be organized based on a specific criteria or it can just be a container that holds all raster types.

The components of a Python Raster Type are:

The basic architecture of implementing a raster type in python is straightforward:

  • ArcGIS provides a Python Raster Type adapter that interfaces with the ArcGIS system and the python module for the raster type implementation.
  • The adapter loads the python module and looks for RasterTypeFactory to identify the participating raster types within this module.
  • The RasterTypeFactory must contain atleast one public function, getRasterTypesInfo, which returns information about all the Raster types within the factory.
  • getRasterTypesInfo returns a dictionary of RasterTypeDefinitions
  • The adapter then retrieves information about the RasterTypes and treats the python based raster types just like any other raster types that are in-built in ArcGIS
  • The ArcGIS framework then interacts with the Raster Type using the Python Raster Type using the Builder API and the Crawler API