Chapter 10:Â
Reading Notes:
- This chapter was about working with rasters, and overall, I would say it was the chapter with content that felt the most familiar to me outside of the ones covering basic scripting techniques.Â
- There are only a handful of tools available in arcpy.ia that are not available in arcpy.sa. It is good practice to use the arcpy.sa module when using tools common to both modules.Â
- BandCount will determine if the raster is a single or multi-band.
- Raster Calculator is one of the few geoprocessing tools not available in ArcPy since you can write expressions right into the script.Â
- 6 Neighborhood objects: Annulus (ringlike), Circle, Irregular, Rectangle, Wedge, Weight
- NumPyArrayToRaster() and RasterToNumPyArray() can convert rasters to NumPy arrays and vice versa. Some functions in the da module work with NumPy arrays.Â
Answers to Review Questions:Â
- A raster object is a raster class that references a raster dataset created by referencing an existing raster on disk, running a geoprocessing tool, or using a map algebra statement. Geoprocessing operations and map algebra expressions result in temporary outputs because raster workflows often require multiple steps, so temporary outputs allow for lower storage requirements as rasters for intermediate steps do not need to be saved.Â
- Tools common to both the sa and ia modules are tools for map algebra, overlay, image classification, and statistical analysis. Spatial Analyst alone includes general raster analysis tools and more domain-specific tools. Image Analyst alone includes tools for deep learning and motion imagery analysis.Â
- A raster dataset is a data model stored on disk or in a geodatabase that can be single or multi-band. A raster band is only one layer in the raster dataset with values for a specific range in the EM spectrum. Raster datasets come in a TIFF, JPEG, etc., whereas raster bands have the property of cell size. All properties can be accessed using either Describe() or da.Describe(). Bandcount, compressionType, format, permanent, and sensorType properties are unique to raster datasets vs raster bands.Â
- Map algebra statements can be preferred over geoprocessing tools because the expressions can be short, but also used for more elaborate statements.Â
- You can use map algebra in Python to identify certain areas of elevation in a raster or perform mathematical operations with rasters, including conversions, for a few examples. However, some of the tools in the math toolset do not have an equivalent math algebra operator.Â
- In order to carry out reclassification, you need to create a remap table. You can do this using the RemapValue function and giving it the remapTable object as a parameter. The object created using the RemapValue function can then be used as a parameter in Reclassify(). As an alternative to this method, you can also use a RemapRange object to remap a range of values instead of individual values.Â
- Raster Cell Iterator reads each individual cell using an indexed location, which is different from geoprocessing tools, which typically process the entire raster without inspection of each individual cell. You can use RCI to assign values to specific cells, create empty rasters, and handle NoData values.Â
- Raster functions in ArcGIS Pro are applied directly to the cells of raster datasets without writing a new raster to disk, which is different from their sa and ia equivalents, which write results to disk as new raster datasets.Â
Chapter 11
Reading Notes:Â
- The ArcGISProject object uses the save() and saveACopy() methods. SaveACopy is the same thing as Save AS.Â
- Setting an environment will not work unless it is within the same folder as the .aprx file.Â
- Using the ArcPy mp module, you cannot create a new project, create new layouts, elements, or reports.Â
- You can use supports() to determine if a layer supports a certain property.
- Only text and pictures can be modified in a layout, not the actual content.
- You can also access the Cartographic Information Model (CIM) in Python, which is used to document cartographic descriptions of GIS datasets.Â
Answers to Review Questions:
- In order to determine the contents of a project in ArcGIS Pro, you can use methods like listLayouts(), listMaps(), and listReports() for a few examples. You often create an object and then use one of these list methods on said object as is appropriate.Â
- Layer properties like adding basemaps, adding data from a path, adding a layer, inserting a layer, moving a layer, and removing a layer are all methods that can be used to directly change the properties of a layer in the mp module. You can also read and write properties like brightness, contrast, show labels, symbology, transparency, and visible.Â
- In order to reference a layer in one map and add it to another in the same project, you need to first have a parameter of a Layer object, which is an existing layer in the map you wish to add to. Then you will need to create another layer object or LayerFile, which is the layer to be added. Then you finally need a string that will specify whether your referenced layer should be added before or after your first layer object.Â
- A Layer object is a layer that is already a part of the map, and you are referring to it. A Layer file object is a layer that can stand alone without reference and includes a layerâs symbology, data, etc.Â
- Raster layers have 3 types of colorizers: RasterClassifyColorizer, RasterUniqueColorizer, and RasterStretchColorizer that can modify symbology. Feature layers have 5 types of renders: GraduatedColorsRenderer, Graduated Symbols Renderer, Simple Renderer, UnclassedColorsRenderer, and UniqueValuesRenderer that can modify symbology.Â
- Properties of symbology objects are read-only, but methods can be used to give access to the properties. The color of a symbol can be modified using the color property of the Symbol object. In addition, you can also change the outline color, size, and predefined style through the symbol class.Â
- The camera object controls the XY and Z values of the map, for which 2D maps X and Y represent the center of the view. For 3D maps, XYZ represents the position of the camera relative to the view.Â
- One of the most common tasks using the mp module is to export a layout file. Other common uses that were discussed include: updating the data sources, copying layers from one map to another, and even replacing text in multiple projects.