Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GEOG 315, GIS Programming, Fall 2020; Lecture 11

alan.kasprak
November 06, 2020

GEOG 315, GIS Programming, Fall 2020; Lecture 11

alan.kasprak

November 06, 2020
Tweet

More Decks by alan.kasprak

Other Decks in Education

Transcript

  1. GEOG 315: GIS Programming and Web Mapping Lecture 11 –

    Selection Sets Reviewed, and Toolboxes
  2. For today… 2. Work together through a problem on selection

    sets 3. An introduction to toolboxes, this week’s topic 1. Quick review of format strings GEOG 315: GIS Programming and Web Mapping Lecture 11 – Selection Sets Reviewed, and Toolboxes
  3. GEOG 315: GIS Programming and Web Mapping Lecture 11 –

    Selection Sets Reviewed, and Toolboxes 1. Quick review of format strings The format() method formats the specified value(s) and insert them inside the string's placeholder. The placeholder is defined using curly brackets: {}. Even better, use {0} and {1}’s:
  4. If you’ve got math to do, do it in the

    format() function… Not in the format string itself, because strings can’t have math in them: Even better, do your math outside the format line entirely
  5. You’ve all used toolboxes in ArcPro and ArcMap, right? Ever

    wonder what’s in those toolboxes? Ever wonder how they’re made?
  6. You’ve all used toolboxes in ArcPro and ArcMap, right? Ever

    wonder what’s in those toolboxes? Ever wonder how they’re made? Tools often take inputs (a feature class, a number) and produce an output.
  7. You’ve all used toolboxes in ArcPro and ArcMap, right? Ever

    wonder what’s in those toolboxes? Ever wonder how they’re made? Tools often take inputs (a feature class, a number) and produce an output.
  8. Often, a single task requires lots of tools in order.

    Watershed delineation is a good example. Delineating a watershed starts with a digital elevation model (DEM) and involves like a million steps.
  9. Often, a single task requires lots of tools in order.

    YOUR DEM YOUR NICE WATERSHED POLYGON
  10. Often, a single task requires lots of tools in order.

    Wouldn’t it be nice to make your own toolbox that used a DEM as input and produced a watershed polygon as output? Yes, yes it would. Because then you’d just have to provide your DEM and hit “Go”. There are two ways to do this: 1. Write some Python code that runs on its own (i.e., a python script) and then have ArcPro convert it to a Toolbox for you. 2. Write some Python code in a format that ArcPro recognizes and just upload it into ArcPro directly. This way’s simpler, but toolboxes can get corrupted. This way is safer – the only way the toolbox breaks is if your code changes (and you can always fix that). This week, we’ll create some custom toolboxes in ArcPro.
  11. Lab this week will consist of Script Demos and Homework

    Problems Two Homework Problems 1. Write a Python script that does some geoprocessing 2. Turn your Python script into a toolbox in ArcPro Two Demo Markdown Files for Comprehension 1. Making toolboxes with scripts 2. Making toolboxes with Python code Read homework.md carefully to see what to turn in! Turn these in for this week’s Jupyter assignment Turn these in for this week’s Homework assignment