Module 03

Geoprocessing II: spatial modeling

Yesterday in the Great Smokies
Webcam archive
GEO 409: Advanced GIS

Announcements

  • Please see me in office hours
  • or schedule a time to Zoom
  • if Notebooks still seem completely alien.

Geo Career Night

  • Stuckert Career Center
  • Wednesday, February 7, 5-7 pm.
  • Link to event

Virtual field trip to

Louisville Waterfront

38.263568,-85.741381

Historic images from ExploreUKy.edu

Lab 2 review

Your boss says, "Shearer, get in here!"
"This looks like a long 20 miles."
You think, "Uh-oh, I know I used 20 miles."

This looks fishy!

0.66%, 10.5 sq mi of Open Water
5.96%, 95.3 sq mi of Developed, Open Space
3.76%, 60.2 sq mi of Developed, Low Intensity
2.09%, 33.5 sq mi of Developed, Medium Intensity
0.85%, 13.7 sq mi of Developed, High Intensity
0.26%, 4.1 sq mi of Barren Land
14.73%, 235.6 sq mi of Deciduous Forest
0.73%, 11.6 sq mi of Evergreen Forest
4.65%, 74.4 sq mi of Mixed Forest
0.13%, 2.1 sq mi of Shrub/Scrub
0.46%, 7.3 sq mi of Herbaceuous
61.94%, 990.7 sq mi of Hay/Pasture
3.7%, 59.1 sq mi of Cultivated Crops
0.04%, 0.7 sq mi of Woody Wetlands
0.03%, 0.5 sq mi of Emergent Herbaceuous Wetlands

Know your tools

  • Read the docs for functions you use.
  • At the very least, know the required parameters.

Solution?

  • If you Notebook already works:
    • Delete output geodatabase
    • Apply the fix in the Notebook
    • Rerun entire notebook
  • Submit revised Notebook by Thursday, end-of-day.

Goals

  • Fine tune our AOIs.
  • Use spatial modelling to predict unobserved conditions.
  • Use lidar derivatives 🏋️‍♀️.

Review Geoprocessing

Geoprocessing

  • "A framework and set of tools for processing geographic and related data."
  • Framework: workspace, environment, sequence of functions.
  • Tools: functions like buffer, clip, etc.
  • Input => Output

Automated

  • Steps are scripted in the Notebook.
  • Workspace parameters are exposed at the head of the script to control downstream cells.

Automate at scale

  • Programmatically run an entire workflow
  • on unlimited amounts of data.
  • Once coded, work on same data but from different area.

Previous labs

  • were totally input => output.
  • This lab will be more exploratory.
  • Get comfortable changing function parameters, rerunning cell, examining output.

Custom AOIs

Essential first step

  • to define the area of interest.
  • Can we use counties, river corridors, whatever we can draw on a map?
  • Yes!

Refactor point AOI

  • into a single function.
  • Use it anywhere to get a buffer around a point.

In-class task

  • Create new 'module-03' project and 'lesson-03.ipynb' Notebook.
  • Open lesson docs to 'custom areas of interest'
  • and create the function and make an AOI.

AOIs from existing features

  • Use a county or river corridor as an AOI.
  • Select feature
  • and use CopyFeatures() and/or Buffer() functions.

Arbitrary AOIs

  • Any shape you can draw on a map.
  • Use use CreateFeatureclass() function to create empty layer.
  • Use Edit ribbon to create shape and save it.

In-class task

  • Create three new AOIs.
    • A county
    • A river
    • An arbitrary shape

Spatial Modeling

Spatial Modeling

  • Spatial data encodes observations and models where conditions exist.
  • Can accurate/precise observed data predict unobserved conditions?
  • Roads are now mostly GPS'd. Can their density predict population?

Spatial Modeling

Where xn in y, z exists

Spatial Analyst tools

  • produces temporary raster object.
  • Leverage Python and map algebra to facilitate modeling and analysis.
  • Link

Map algebra

  • Uses elementary algebra (+, - <, >, etc.)
  • on one or many raster layers
  • to locate where a condition exists.
  • Produces temporary raster.

Map algebra

  • Enclose all queries with ()
    • z = (elev > 1000)
  • Logical operators and and or
    • & (and)
    • | (or)
    • z = ((elev < 1000) & (elev > 900))

Raster

Review

Resolutions

  • Spatial: how large is each cell?
  • Temporal: how often is the same scene captured?
  • Bit depth: 2n number of values the cell can store.
  • Spectral: how much of the spectrum, e.g. light, is captured?

Matrix of cells

  • of numeric values.
  • Is it a quantity
  • or an category?

Continuous

  • Measures a varying phenomena
  • like elevation, slope, etc.
  • in a single band.
  • Cell values are a quantity.

Discrete

  • Measures distinct types
  • like land cover type
  • in a single band.
  • Cell values are a category.

Image

  • Measures reflected or emitted light
  • like a photograph
  • in multiple bands.
  • Cell values are a relative intensity.

Identity

  • identifies whether a condition exists
  • like elevations above 1000 feet
  • in single band.
  • Cell values are either 0 or 1.

In-class task

  • Find the area of elevations over 2,000 feet in Ky.
  • Find the highest and lowest elevations in Ky.

Multiple layer queries

Surface Parameters

  • Spatial Analyst function to model elevation surface.
  • Slope: rate of elevation change in steepest direction. Measured in degrees.
  • Aspect: direction of steepest slope. Measured in degrees 0-360 with 0 being north.

In-class task

  • Find the north-facing steep slopes in Ky.
  • Slope greater than 16 degrees.

KyFromAbove

  • Authoritative source of high-resolution aerial imagery and elevation data for Kentucky.
  • Download individual tiles or load as an ArcGIS service.

Use as an ArcGIS service

  • Add a new ArcGIS Server and use this URL:
  • https://kyraster.ky.gov/arcgis/services

Data

  • DSM (Digital Surface Model) shows the first return of the laser pulse: elevation of above ground features.
  • DEM (Digital Elevation Model) shows hydrologically enforced (e.g., bridges removed) bare-earth elevations.
  • NAIP (National Agriculture Imagery Program) leaf-on 4-band imagery.

Height raster

  • Subtracting the DEM from the DSM gives us a height raster for above ground features
  • such as buildings, bridges, and trees.
  • How high is the bridge connecting Whitehall Classroom Building with POT?

Tree canopy

  • Where are the trees?
  • Model tree location and height.

Where are green things?

  • A derivative of NAIP imagery assesses the health of vegetation.
  • Uses 4-band imagery to calculate a vegetation index.
  • A higher value indicates more vegetation.

NDVI

  • Normalized difference vegetation index (NDVI) compares reflected red to near-infrared light (which we cannot see with our eyes but can with optical sensors)
  • estimate the health and density of green vegetation.

Inspection

  • After creating the NDVI raster, which value is the minimum threshold for vegetation?

In-class task

  • Find cells that have vegetation and are over 5 feet tall.

Location?

  • We might have location but not height.
  • Use Con function to create a new raster.
  • Where this query is true, use the cell value from this raster.

Analysis

  • Group height values into discrete classes.
  • 5-15 feet, 15-35 feet, etc.
  • Count the number of pixels in each class.

Lab 3

Lab

  • Find a desired condition in your AOI.
  • Notebook should produce an analysis layer.
  • This 'recipe' should run on any ArcGIS Pro instance with minimal modification.

Exploration

  • The conditions you set require some exploration of your data.
  • What are the ranges of values in your raster?
  • Do they correspond to your on-the-ground observations?
  • No right answer – just how well does your analysis match the desired condition.

In-class task

  • Visualize data in new Local Scene
  • add DSM as ground elevation layer
  • symbolize NDVI to visualize vegetation
  • and explore 3D map.

Addendum

Mini apps

Workflow

  • Self-contained Notebooks
    • using data from KyFromAbove.
  • Run top to bottom.
  • Rerun cells testing different arguments.
  • Save final layers to geodatabase.

Viz

  • Visualize your output
    • over different base maps.
  • Explore!
  • We'll do cartography in the next module.

Contouring

  • Notebook: create-smooth-contours.ipynb
  • Lines of equal elevation interpolated from an elevation surface.
  • Find cliff line and estimate height (if cliffs are present).

Labels and symbology

  • Symbolize lines with index field
  • Give labels a halo effect that matches the color of the base map.
  • ArcGIS Pro labeling basics

Solar mapping

Can I see sunshine?

  • Use the Hillshade function with shadows enabled
  • to estimate the amount of direct sunlight
  • based on slope of surface.

Where is the sun?

  • Use NOAA's solar calculator
  • to find the sun's position
  • on any given day and time.

Symbology

  • Symbolize output layer over NDVI
  • with a high values bright yellow
  • and use Layer blending mode: Screen.

Bonus

  • Create animation of sun's illumination over time
  • with open-source command line tool ffmpeg.
  • Example in addendum.

Review

Python III

Python collections

Collections

  • of data.
  • Ordered vs. unordered
  • mutable vs. immutable
  • Nested collections (collection of collections)
  • Looping through collections

Lists

  • An mutable, sequence of items or elements
  • separated by a comma
  • and enclosed in square brackets.
  • Items can be any value.

Tuples

  • An immutable, sequence of items or elements
  • separated by a comma
  • and enclosed in round brackets.
  • Items can be any value.

Tuples

  • Think of tuples like records in a database,
  • a collection or related information
  • often of a different type.
  • Tuples are fast.

Dictionaries

  • An unordered collection of items
  • stored as key:value pairs
  • separated by a colon
  • and enclosed in curly brackets.

Dictionaries

  • Access key:value pairs is like looking in a dictionary.
  • Iterating over...
    • keys
    • values
    • key:value pairs

Advantages of each?

  • Lists are easy to build/modify
  • Tuples are fast to access and secure
  • Dictionaries are fast, tidy, and easy to build/modify

STOP