Wade: Chapter 5: Geoprocessing Using Python


Class: like an outline for creating a new object

Environment: a tool that helps to keep dependencies required by different projects separate

Factory Code:Factory method is a creational design pattern which solves the problem of creating product objects without specifying their concrete classes. Factory Method defines a method, which should be used for creating objects instead of direct constructor call ( new operator).

Function: a block of code that only runs when it is called.

Hard-Coded: A part of a program that has been declared as unchanging

Instance: An individual object of a certain class.

Method: a function that “belongs to” an object.

Namespace: a system that has a unique name for each and every object in Python

Object: Everything is in Python treated as an object, including variable, function, list, tuple, dictionary, set, etc. Every object belongs to its class.

Package: A package is basically a directory with Python files and a file with the name __init__ . py. This means that every directory inside of the Python path, which contains a file named __init__ . py, will be treated as a package by Python.

Property: the main purpose of Property() function is to create property of a class.

Well-known ID (WKID): a unique number assigned to a coordinate system.

Well-known text (WKT): an Open Geospatial Consortium (OGC) standard that is used to represent spatial data in a textual format.

Workspace: supports the embedding and running of Python scripts within a workflow.


Review Questions


  • Explain some of the uses of the “Result” object. 
    • The result object can be used as an input to another function. The result object also has properties and methods.



  • Why are classes used as input parameters for geoprocessing tools?
    • Classes are often used as shortcuts for tool parameters that would otherwise have a more complicated equivalent.


  • What are some of the typical environments set in a script?


      1. ClearEnvironment.
      2. ListEnvironments.
      3. LoadSettings.
      4. ResetEnvironments.
      5. SaveSettings


  • Explain how Pro is licensed and how this impacts handling licensing when writing scripts.
    • You must have a license to run geoprocessing tools, which includes running a stand-alone python script that uses these tools. You will receive an error message if you try to run a tool that you do not have a license for, such as Spatial Analyst tools.