{"id":295,"date":"2025-03-28T15:25:25","date_gmt":"2025-03-28T20:25:25","guid":{"rendered":"https:\/\/sites.owu.edu\/geog-293\/?p=295"},"modified":"2025-03-28T15:25:25","modified_gmt":"2025-03-28T20:25:25","slug":"hollinger-week-2","status":"publish","type":"post","link":"https:\/\/sites.owu.edu\/geog-293\/2025\/03\/28\/hollinger-week-2\/","title":{"rendered":"Hollinger Week 2"},"content":{"rendered":"<p><b>Chapter 3:<\/b><\/p>\n<p><em>Reading Notes:<\/em><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">I don\u2019t think that I have ever searched for a tool using the analysis gallery. I usually always go straight to the geoprocessing pane, which seems more robust anyway.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Built-in tools: Built using ArcObjects and compiled in PL like C++.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Script Tools: Python Scripts are accessible from the dialog box.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Model Tools: Created using model builder<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">System vs. Custom Tools<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Current vs. Scratch workplace: Current specifies where inputs and outputs are placed and Scratch is used for intermediate data in model and script tools.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Environments can be set for the application, the individual tool, the properties of a model, or a script.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Data Connectors, Environment Connectors, Pre-Condition Connectors; and Feedback Connectors<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">You can schedule a script to be run at a certain time.\u00a0<\/span><\/li>\n<\/ul>\n<p><em>Answers to Review Questions:<\/em><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The geoprocessing framework includes toolsets and toolboxes, the ability to search and run tools, environment settings, and parameters, dialog boxes for controlling and executing tools, ModelBuilder (a point + click visual programming language for sequence tools), a Python window, geoprocessing history and lots, and methods for creating python scripts.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The three types of tools are built-in tools, script tools, and model tools.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">System tools are installed as a part of the ArcGIS Pro Software and created by ESRI. Most system tools are built-in, but some are scripts. Custom tools are created by a user or obtained by a 3rd party and usually consist of script and model tools.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Different environments include: Workspace defines the path of where your datasets are located and where your inputs are and outputs will be. There are also settings for specific data types and functions as well.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The limitations of batch processing are that filling out the tool can take some time and the tool does not execute faster than normal. However, the strengths are that once you have populated the batch tool it can run multiple times without user input which can be nice for repetition of a task (for example, clipping multiple layers to the same extent).\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Dynamic naming allows you to create a unique name for each output layer in batch processing. %Name% is used to take the first part of a layer name and create the output name. Without this step, the file would be continually overwritten. The same process could be done for a path and other output elements.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ModelBuilder requires no programming experience and has little syntax. Scripting has some functionality for lower-level tasks and more advanced programming logic that Model Builder does not. Scripting can also be used to combine applications and can stand alone outside of ArcGIS Pro. The two are similar because there are many geoprocessing workflows that work in both ModelBuilder and Scripting.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">You may choose a script workflow instead of a model for a lower-level task or a more advanced function\/extension with additional packages that can only be done in scripting. Additionally, scripting allows for the use of other software like Excel or R as well. Then finally, as mentioned above, scripts can be run and stand-alone outside of ArcGIS Pro.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">I am honestly not 100% sure if this is what this question is asking, but to automate workflows you can run Python code in ArcGIS\u2019s Python editor or use an external editor like IDLE or PyCharm.<\/span><\/li>\n<\/ul>\n<p><b>Chapter 4:<\/b><\/p>\n<p><em>Reading Notes:<\/em><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Immutable vs. mutable<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">I have never used a tuple before so I looked it up. It\u2019s basically a list but you cannot edit its contents.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The most important statements in a programming language are statements that assign values to variables.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Every object has a value, a unique identifier, and a type.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Methods are functions coupled to an object like: &lt;object&gt;.&lt;method&gt;(&lt;arguments&gt;)<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">F-strings example: f&#8221;The temperature is {temp} degrees\u201d<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Pairs are also referred to as items in the dictionary<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Set is another datatype to organize elements. It is an unordered collection without duplicates and the elements are enclosed with curly braces. Elements of a set must be immutable.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">input() function gets user input<\/span><\/li>\n<\/ul>\n<p><em>Answers to Review Questions:<\/em><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The main data types are strings, integers, float, and Boolean. Lists, tuples, and dictionaries are more complex data types. Strings, lists, and tuples are sequences. Strings, numbers, and tuples are immutable because you can replace them with new values, but not modify them. Lists and dictionaries are mutable.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">True division is a floating point division where the result of division is reported as a decimal even if the numerator and denominator are integers. In floor division you use the \/\/ symbol and the division is truncated to zero decimal points, except for with negative numbers where the result is rounded up (really down) to the nearest whole number.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Dynamic assignment of the variable means that the type of your variable will be automatically inferred based on whatever values you assign to it.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">variable_name1 and variablename2 would be examples of good variable names because they consist of only letters, digits, and underscores and they don\u2019t include Python keywords or variable names. In a real scenario, these should also be more descriptive of what the variable represents like count or my_raster.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">An expression comes from literal values using operators and functions, but a statement is an instruction that tells the computer to do something.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Quotation marks are used to denote something as a string in Python. Double and single quotation marks can be used interchangeably.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Unicode strings are strings stored in characters of the Unicode system which is designed to represent every character from every language. Because of this, you can work with many different languages in Python.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Five built-in Python functions \u2014 #1: print(x) would print the contents of the variable x. #2: id(x) would return the unique identifier of the variable x. #3: type(x) would return the object type of the variable x. #4: abs(x) would return the absolute value of the numeric variable x. #5: round (x, n) would round the float variable x off to n number of digits.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Dot notion may look something like this &lt;object&gt;.&lt;method&gt;(&lt;arguments&gt;) and it is when the object is written before the period with the method following. It shows that whatever is after the period belongs to the object before the period.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Forward indexing will assign elements an index from first to last starting with 0. Reverse indexing will assign elements an index from last to first starting with -1.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Three methods of string objects \u2014 #1: join() method given a list of elements will join them into a single string. #2: strip() method will remove any of the given characters in the argument from the string no matter what order they are in. #3: replace() method will replace one substring with another everywhere it occurs.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Lists and Tuples are generally the same except that you can modify a list while tuples are immutable and the sequence and elements cannot be modified.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A Boolean is used to evaluate if an expression is either true or false.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">To create a dictionary you would populate it as follows: dictionaryname = { \u201cKey\u201d : \u201dValue\u201d, \u201cKey2\u201d : \u201cValue2\u201d, \u201cKey3\u201d : \u201cValue3\u201d } You could also create an empty dictionary by not putting anything in the brackets. To add an element you would do as follows: dictionaryname[\u201cKey4\u201d] = \u201cValue4\u201d.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">You should avoid backslashes because they are used as an escape character in Python.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Branching is kind of like a chose-your-adventure situation in the sense that you just need to decide to take one path or another. Typically this means using if statements.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A compound statement is a block that contains multiple statements and statements that determine when other statements will be executed like if, for, while, try, and with.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Two main loop structures: A while looping structure runs the other statements within the block while the argument given in the while statement evaluates true. Then there is a for loop which typically runs for the duration of a sequence.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">You can use a backslash as a line continuation, or (), [], and {} as an implied line continuation to improve readability for long lines of code.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Comments provide information and descriptions about your script that can help you remember and others understand why the script was created.<\/span><\/li>\n<\/ul>\n<p><b>Chapter 5:<\/b><\/p>\n<p><em>Reading Notes:<\/em><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ArcPy is organized into modules, functions, and classes<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Workspace is your default location for files and can be set in a script<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Good practice not to add extra spaces<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Quotation marks are always straight in Python<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Parameters have a name, type, direction, and required value<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Non-tool functions are available only in ArcPy<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Environments are set as properties of the env class<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">All functions have a reference\/help page that includes sample code, syntax, and explanations of each parameter.<\/span><\/li>\n<\/ul>\n<p><em>Answers to Review Questions:<\/em><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Geoprocessing tools in ArcGIS Pro can all be accessed through ArcPy. To reference a tool its tool name is often the same as the tool label in ArcGIS Pro without spaces. To reference a tool you would also need to include its toolbox alias.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Required parameters must be specified for a tool to run. Optional parameters are just as they sound, optional, and are usually indicated in documentation by curly brackets. This affects script writing because parameters must be specified in the order listed in the tool documentation. You can specify the name of a parameter or fill its spot with \u201c\u201d or # when not defining all of the optional parameters.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">An example of using variables instead of hard-coded values as parameters would be: arcpy.Clip_analysis(input_file, clip_file, output_file).<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The result object can be used as input for another function as it may contain the path to a dataset, it may also return a string, number, or Boolean values. The result objects will also include messages and parameters based on the tool run.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Classes are used as input parameters as a shortcut that would often be much more complicated. This helps in scenarios where parameters cannot be defined by just a simple string like coordinate systems for example.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">To reference a coordinate system you can use arcpy.Describe(), arcpy.da.Describe(), use the name of the coordinate system (ex: arcpy.SpatialReference(&#8220;NAD 1983 StatePlane Texas Central FIPS \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 4203 (US Feet)\u201d), or using the factory code\/well-known id (ex: arcpy.SpatialReference(2277)).\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Some typical environments set in a script are the workspace (ex: arcpy.env.workspace = \u201cC:\/Data\u201d), the cell size (ex: arcpy.env.cellSize = 30), and allowing overwriting (ex: arcpy.env.overwriteOutput = True).\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">You can obtain a meaningful message by using arcpy.GetMessages(), which is typically the most useful and will give you a list of messages. arcpy.GetMessageCount() will allow you to obtain the number of total messages and can be useful for viewing the last message. Finally, arcpy.GetMaxSeverity() will return a severity level indicating an information, warning, or error message.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ArcGIS Pro is licensed with a Named User license, a Single Use license, and a Concurrent Use license. Available products may vary based on the user account. Scripts will not run and extensions using ArcPy cannot be checked out if no license is available. <\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Chapter 3: Reading Notes: I don\u2019t think that I have ever searched for a tool using the analysis gallery. I usually always go straight to the geoprocessing pane, which seems more robust anyway. Built-in tools: Built using ArcObjects and compiled <span class=\"readmore\"><a href=\"https:\/\/sites.owu.edu\/geog-293\/2025\/03\/28\/hollinger-week-2\/\">Continue Reading<\/a><\/span><\/p>\n","protected":false},"author":2177,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-295","post","type-post","status-publish","format-standard","hentry","category-chapter-notes"],"_links":{"self":[{"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/users\/2177"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":1,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":296,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/posts\/295\/revisions\/296"}],"wp:attachment":[{"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}