NR 218

NR 218

Use arrows or menu in bottom left corner to navigate

Syllabus

NR 218 - Introduction

Class Details

  • Location
  • Times:
    • Monday:
      5:10 - 6:00 Lecture
      6:10 - 9:00 Lab
    • Wednesday
      6:10 - 9:00 Lab

Instructor Details

  • Michael Huggins
  • Office Hours:
    • Building 72 (Plant Conservatory) Room 107
      Mondays 2:30 - 4:30s

Learning Goals

  • Analyze spatial data
  • Create maps using geospatial software
  • Produce quality graphics
  • Apply skills in Remote Sensing, GIS, and data science to solve a problem of your own design
  • Understand basic principles of GIS

Active Learning and Growth Mindset

  • This class will be challenging - learning new skills is hard
  • Recognize that you won’t be good immediately
    • Mastery takes time and repetition
  • Ask for help!
    • Internet, classmates, professor
    • Try not to rely on AI

  • Don’t be afraid to mess up
  • Crash the computer, it’s ok!
  • Think critically and logically, don’t get frustrated
  • There will be lots of hands-on work time in this class
  • Suggest bringing laptop if you have one

Try not to rely on AI

  • AI generated text may not be used for any writing .
  • It is ok to seek AI assistance for project work, but it is important to consider that AI has the potential to make you stupid and waste your time!
    • Depending on AI prevents development of critical thinking, writing, and problem-solving skills
    • AI will sometimes lead you down a terrible, deep rabbit hole of confusion
    • Getting quick answers without working through problems will leave gaps in foundational knowledge needed for advanced coursework
    • The struggle of working through difficult concepts is often where the most valuable learning occurs

That is not to say LLMs are never useful or appropriate to use, but you need to know its limitations.

Class Icebreaker

Three things in common

  • Get is small groups
  • Take 5 minutes to identify three things you have in common with each other
    • Choose intresting things. The stranger, the better
    • Boring examples:
      • “We are a forest and fire sciences majors”
      • “We are all from Southern California”

What is GIS Why is it important

What is GIS?

Computer-based tools used to store, visualize, analyze, and interpret geographic data

OR
Collection of computer hardware, software, data, personnel, and work procedures to store, update, manipulate, analyze, and display all forms of geographic information.

Application Domains

GIS is useful is many domains, for example:

  • weather forecasts
  • navigation
  • delivery logisitics
  • apps (e.g. Strava!)
  • disaster response
  • infrastructure monitoring
  • climate monitoring / modeling
  • urban/regional planning
  • architecture
  • archaeology
  • geography
  • social sciences
  • (geo)physics
  • hydrology
  • biology
  • ecology
  • etc…

Why use GIS

Monitor and understand our planet

Planning

Disaster Response

Software

  • This class will be taught using QGIS (but you can use anything you want)
  • Software changes - We will focus on building an understanding of the concepts that will allow you to successfully use any GIS software.
  • I will occasionally show examples of analysis using other tools, particularly Python.

There are many other common (GUI based) GIS software platforms:
- ESRI (ArcGIS suite)
- GRASS
- Google Earth Engine
- Google Earth Pro
- ENVI
- SAGA
- etc…

There are also command line tools
- GDAL
- PDAL
- WhiteBox Tools

Additionally, GIS can be performed purely using scripting languages
- Python
- R
- Javascript
- Julia

Software - benefits of open source

  • Available to you, for free, forever (even after Cal Poly)
  • It’s free, as in liberty. If you need extra functionality in QGIS, you can do more than just hope it will be included in the next release. You can sponsor the development of a feature, or add it yourself if you are familiar with programming.
  • Compatible with any operating system (Windows, Mac, Linux)
  • Collectively advances human knowledge / progress
  • Commonly used in many organizations
  • Easier to learn ArcGIS after QGIS than the other way around

Beautiful Maps

Some basic GIS Concepts

Location

  • Position
  • A position on the surface of the earth
  • How do we define a location?
    • Nominal location - By name
      • Helsinki, Finland
      • Appalachia
    • Relative
      • Oakland is east of San Francisco
    • Absolute Location - can be defined using Coordinates
      • Postal Code
      • X,Y,(Z) is the Cartesian coordinate system
      • Latitude and Longitude are the (non-projected )Geographic Coordinate System

Direction

The position of a feature or phenomenon on the surface of the earth relative to some reference point

  • Egocentric location, to my left
  • Landmark direction, towards the mountain

In geography and GIS, there are three more standard benchmarks that are used to define the directions:

True north (and south) is towards the point at which the axis of the earth’s rotation intersects the earth’s surface

Magnetic north is towards where the Earth’s magnetic fields merge in the North

Grid north is the northward direction of the grid lines of latitude and longitude on a map

True north

Magnetic north

Grid north

Distance

  • The separation between locations

    • Nominal (e.g. close/far) or Absolute (1 kilometer)
  • Cartesian distance on a flat surface is easy:
    \[ D = \sqrt{(x_{2} - x_{1})^{2} + (x_{2} - x_{1})^{2}} \]

  • Distance on a 3-Dimensional surface is complicated. We will discuss it later

Space

Space is kind of an ambiguous term.

For GIS we are often interested in topological space

  • Positional relationships between places / nodes /objects
  • e.g. subway map

GIS

All GIS systems have a database that can relate spatial-data and attribute data.

  • Spatial data is made up of points, lines, polygons, etc… which represent locations or features in the real world, e.g. a linestring representing a river.

  • Attributes are data associated with the features, e.g. the population ofa city.

Layers

Models representing different aspects of the physical world

Attributes

OBJECTID GlobalID type source poly_DateCurrent mission incident_name incident_number area_acres description FireDiscoveryDate CreationDate EditDate displayStatus geometry
0 3025 04ba1d01-c043-478f-ad62-e7eeb903cf09 Heat Perimeter FIRIS 2025-01-01 05:39:02.359000+00:00 CA-SBC-OAK-N40Y Oak None 41.998143 FIRIS Perimeter NaT 2025-01-01 05:37:18+00:00 NaT Inactive POLYGON ((-120.24304 34.88387, -120.24302 34.8...
1 3026 4551a5e4-e94d-46e2-9aac-73cc4314c946 Heat Perimeter FIRIS 2025-01-02 05:16:55.340000+00:00 CA-SDU-BORDER1-N40Y None None 16.911501 FIRIS Perimeter NaT 2025-01-02 05:13:35+00:00 NaT Inactive MULTIPOLYGON (((-116.82928 32.59686, -116.8293...
2 3027 2b1329f3-5b39-4c0e-ad34-1250e436e0e1 Heat Perimeter FIRIS 2025-01-07 22:11:19.142000+00:00 CA-LFD-PALISADES-N57B None None 771.572356 FIRIS Perimeter NaT 2025-01-07 22:09:29+00:00 NaT Inactive MULTIPOLYGON (((-118.55013 34.06195, -118.5501...
3 3028 a766c1b5-1d8e-43b3-9aac-02358de18d35 Heat Perimeter FIRIS 2025-01-07 23:17:35.698000+00:00 CA-LFD-PALISADES-N57B None None 1261.520779 FIRIS Perimeter NaT 2025-01-07 23:13:25+00:00 NaT Inactive MULTIPOLYGON (((-118.55013 34.06195, -118.5501...
4 3029 72049d43-03fe-4cc1-899a-fe2eb43934e7 Heat Perimeter FIRIS 2025-01-07 23:17:39.454000+00:00 CA-LFD-PALISADES-N57B None None 1261.520779 FIRIS Perimeter NaT 2025-01-07 23:13:25+00:00 NaT Inactive MULTIPOLYGON (((-118.55013 34.06195, -118.5501...

Attributes of assets/CA_Perimeters_CAL_FIRE_NIFC_FIRIS_public_view.geojson

Right-click layer –> Open Attribute Table

Map Types

There are a few types of maps:

Mental Maps

Reference - shows location information, tend to represent geographic reality accurately, topographic maps for example

Thematic - shows how one or more factors are distributed across space, such as a map of malaria infection rates

USGS Topographic Map of Boulder, CO

European GDP

Dynamic / Interactive
- maps that change depending on user input

Show code
from pathlib import Path

import folium
import geopandas as gpd

aoi_path = Path('assets/Eaton_Perimeter_20250121.geojson')
aoi = gpd.read_file(aoi_path)

# grab centroids
c = aoi.to_crs(epsg=26910).dissolve().centroid.to_crs(epsg=4326).item()

# map
map = folium.Map(
  location=[c.y, c.x],
  tiles='OpenStreetMap',
  zoom_start=12
)

# perimeter
geo_j = folium.GeoJson(data=aoi.__geo_interface__,
  style_function=lambda feature: {
    'color': 'red',
    'weight': 2,
    'fill': False,
    },
    name='Fire Perimeter'
  ).add_to(map)
# layer control

map
Make this Notebook Trusted to load map: File -> Trust Notebook

Mental/Cognitive Maps

  • Psychological tools that we all use every day.
  • Stored in our brain
  • To get from one place to another, or to understand and situate events that we hear about
  • Reflect the amount and extent of geographic knowledge and spatial awareness that we possess

Using a blank sheet of paper, take five minutes to draw a map from memory of San Luis Obispo

What is data? (What are data?)

  • “Related items of (chiefly numerical) information considered collectively, typically obtained by scientific work and used for reference, analysis, or calculation.”
  • “Quantities, characters, or symbols on which operations are performed by a computer, considered collectively. Also (in non-technical contexts): information in digital form.” -OED

What is information?

  • “The imparting of knowledge in general.”
  • “Knowledge communicated concerning some particular fact, subject, or event; that of which one is apprised or told; intelligence, news.”
    -OED

What is Spatial Data?

Data with a geographic and/or spatial component.

What is Metadata

Data about the data, e.g. units, date collected, instruments used…

Checkout Ticket - Some Basic GIS Concepts


Data storage - A superficial Overview

Data Storage

  • We store data in computer-readable format in files
    • Sometimes files store data as text (often called human readable files)
    • Other times there are just 1s and 0s (binary file)
    • Even the human readable files are ultimately stored as 1s and 0s (more on that)

Data Storage

File extensions denote files readable by certain programs, for example:

Extension description
filename.txt text file
filename.doc Microsoft Word file
filename.pdf portable document file
filename.html hypertext markup language
filename.xml extensible markup language
filename.tif tagged image format
filename.json javascript object notation
filename.geojson geographic json
filename.laz LASer zip
filename.parquet compressed table

File types

  • Computer programs only read certain file formats.
  • Familiarity with different file types is helpful.
  • Common GIS file types: .shp (along with its sidecar files .prj, .shx, .dbf, etc), .kml, .tiff, .gpkg, .json, .geojson, .txt, .hdf, .nc, .parquet and a few others

File Paths and Directories

File Organization and Computer Hygiene

Be kind to your future self - keep your files organized:

  • Use directories (a.k.a folders)
  • Use descriptive names:
    • e.g. slo_county_26910.geojson not county.geojson
  • Don’t put spaces in file or directory names (see this)

How to Organize your files

  • Pick a convention and be consistent
  • For example:
/Work/NR_classes/
├── Class1/
│   └── ...
├── NR218/
│   ├── Project_1/
│   │   └── ...
│   └── Project_2/
│       ├── Vector/
│       │   ├── trees.parquet
│       │   └── streams.geogjson
|       ├── Raster/
│       │   ├── dem.tif
│       │   └── rainfall.h5
│       ├── qgis/
│       │   └── project_2.qmd
│       └── Results/
│           ├── Figures/
│           │   ├── figure1.png
│           │   ├── figure2.png
│           │   └── map.png
│           └── proj_2_report.doc

Cloud Storage

Many options, but mounting Cal Poly One Drive as a disk is is probably the simplest.

See the Cal Poly tutorial here or try this, for Linux users or the computer savvy.

Tutorial - (not so) Quick Intro to QGIS

  1. Download SPR_data.zip here (right-click and “save link as”)
  2. Extract the file (Linux, Windows, Mac), and place in appropriate file location (Remember, organize your files!)
  3. Open QGIS

Open the files from the directory you just extracted

Method 1

  1. Use the file location in the ‘Browser’ panel
  2. Drag and and drop files into the Layers Panel

Method 2

  1. Press ctrl-shift-v (cmd-shift-v on Mac)
  2. Click to browse for file then click .
    • You can select multiple files at once when browsing
    • Close window when finished.

Now the layers should be visible in the panel, and on the map

  • Toggle on/off layers by clicking checkboxes
  • Change layer order by dragging within panel
  • What do the little icons between the check and the layer name mean?
  • Right click a layer, select Open Attribute Table
  • Select rows of attribute table by clicking on the left edge (where they are numbered)
    • Note that the corresponding features are highlighted on the map

Panning and zooming (The mouse wheel also zooms while in pan mode)

Select tools

Info

Basemaps

  1. Click Plugins –> Manage and install Plugins
  2. Search for QuickMapServices
  3. Click Install Plugin
  4. Now on the right there should be a Search QMS bar
  5. Search for satellite
  6. Pick one (ESRI is a good choice, or Bing)

Symbology - categorized

  • Right click the “sprLanduse” layer
    • Go to properties
      • Select the symbology tab
  • Experiment with basic symbology
    • Right click the “sprLanduse” layer
      • Go to properties
        • Select the symbology tab
          • From the dropdown menu, select “categorized”
            • Select “LUtype” from the “Value” dropdown menu, and click “Classify”

Symbology - Numerical

  • Experiment with numerical symbology
    • Right click the “sprSoil” layer
      • go to properties
        • Select the symbology tab
          • From the dropdown menu, select “Graduated”
            • Select “KFACTOR” from the “Value” dropdown menu
              • click “Classify”, then “Apply”

Other elements

Use the Add Item dropdown, or the left side toolbar to add a scale bar, and north arrow

Coordinate Grids

  • Be sure you have the Map item selected in the items box.
    • Select the Item Properties tab
      • Scroll down and expand Grids
        • Click green + Button to add grid
          • Click Modify Grid
            • Enter “0.03” for the X and Y intervals
              • Check the Draw Coordinates box to label grids with coordinates.

Export map

  • Once you have something satisfactory, create an export of your map to share.
    • Layout > Export as image
      • Choose file type
        • Set save location

Open the image file we just saved to verify results

What Are some problems here

A quick intro to geospatial data

Human readable vs. binary files

Human Readable

  • file.txt
  • file.csv
  • file.xml
  • file.docx1
  • file.json
  • filename.py

Binary

  • filename.pdf
  • filename.tif
  • filename.laz
  • filename.parquet
  • filename.pyc

Delimiters

Data entries in many text files are separated by a delimiter, such as a comma, tab, space, etc. They also generally have a header describing the contents of each row. For example a csv is a comma delimited file:

  • file.csv
OBJECTID,GlobalID,type,source,poly_DateCurrent,lon,lat
3025,04ba1d01-c043-478f-ad62-e7eeb903cf09,Heat Perimeter,FIRIS,2025-01-01 05:39:02.359000+00:00,-120.244,34.8824
3026,4551a5e4-e94d-46e2-9aac-73cc4314c946,Heat Perimeter,FIRIS,2025-01-02 05:16:55.340000+00:00,-116.83,32.5974
3027,2b1329f3-5b39-4c0e-ad34-1250e436e0e1,Heat Perimeter,FIRIS,2025-01-07 22:11:19.142000+00:00,-118.548,34.058
3028,a766c1b5-1d8e-43b3-9aac-02358de18d35,Heat Perimeter,FIRIS,2025-01-07 23:17:35.698000+00:00,-118.547,34.0589
3029,72049d43-03fe-4cc1-899a-fe2eb43934e7,Heat Perimeter,FIRIS,2025-01-07 23:17:39.454000+00:00,-118.547,34.0589

Reading a CSV

OBJECTID,GlobalID,type,source,poly_DateCurrent,lon,lat
3025,04ba1d01-c043-478f-ad62-e7eeb903cf09,Heat Perimeter,FIRIS,2025-01-01 05:39:02.359000+00:00,-120.244,34.8824
3026,4551a5e4-e94d-46e2-9aac-73cc4314c946,Heat Perimeter,FIRIS,2025-01-02 05:16:55.340000+00:00,-116.83,32.5974
3027,2b1329f3-5b39-4c0e-ad34-1250e436e0e1,Heat Perimeter,FIRIS,2025-01-07 22:11:19.142000+00:00,-118.548,34.058
3028,a766c1b5-1d8e-43b3-9aac-02358de18d35,Heat Perimeter,FIRIS,2025-01-07 23:17:35.698000+00:00,-118.547,34.0589
3029,72049d43-03fe-4cc1-899a-fe2eb43934e7,Heat Perimeter,FIRIS,2025-01-07 23:17:39.454000+00:00,-118.547,34.0589

link to file (right-click and “save link as”)
Tip: Remeber, file organization!

This csv is adapted from CA Perimeters CAL FIRE NIFC FIRIS public view.

Reading a CSV with QGIS

link to file (right-click and “save link as”)

Either Layer --> Add Layer -->> Add Delimited Text Layeror press control V (command V on Mac)

Reading a CSV with QGIS

Delimited text dialogue box

Browse for csv

Notice that it says CRS must be selected.

What is a CRS?

  • We will discuss what a CRS is in great detail later.
  • For now just know it provides a reference frame for placing the coordinates on the map.
  • Coordinate Reference System (CRS) is synonymous with Spatial Reference System (SRS)
  • SRS = CRS

Click the Geometry Definition dropdown to assign an SRS.

Use EPSG:4326 - WGS 84

Click Add

Scale, Coordinate systems, and Map Projections

Map Conventions

Mapping conventions facilitate effective conveyance of information. In most cases using them is a good idea (but not necessarily always)

The Blue Marble photograph in its original orientation.

South’s up!

Map Scale

The factor of reduction of the world so it fits on a map

  • You need to shrink things to make a map
  • On reference maps it is generally important to include a scale bar
  • Representative fraction (RF) describes scale as a simple ratio
    • The numerator, which is always unity (i.e., 1), denotes map distance.
      The denominator denotes ground or “real-world” distance.
    • unit neutral
    • Large vs small, 1:1,000 > 1:1,000,000
    • Large shows more detail

Map Scale

Coordinate systems

  • Frameworks that are used to define unique positions
  • Geographic coordinate system (GCS) is most commonly used framework for defining locations on three dimensional models of Earth
  • GCS is based on a sphere or spheroid (a.k.a. ellipsoid)
  • GCS units are degrees
    • Latitude \(\in 0^\circ, 90^\circ\) (or \(-90^\circ, 90^\circ\))
    • Longitude \(\in 0^\circ, 180^\circ\) (or \(-180^\circ, 180^\circ\))
  • Degrees can be written in degrees-minutes-seconds (DMS) or in decimal degrees (DD).

DMS to DD conversion

128° 40’ 52.0428” W

128° 40’ 52.0428” W

128° 40’ 52.0428” W

128° 40’ 52.0428” W

128° 40’ 52.0428” W

128

128 + (40 / 60)

128 + (40 / 60) + ( 52.0428 / 60\(^{2}\) )

-128.68112299

The negative is important! SLO vs. off the coast of Shandong

Spheroids and Geoids

GCS is based on a sphere, spheroid, or geoid

A geoid is an approximation of the true shape of the earth

    \(\circ\) As defined by its gravitational field rather than its topography 1

    \(\circ\) Gravitational field found by finding equipotential surfaces

    \(\circ\) The geoid is the specific equipotential surface that best approximates mean sea level (MSL) on a global basis

    \(\circ\) MSL diverges from the geoid by up to 2 m in places.

Spheroids and Geoids

The geoid is pretty complex…

so the surface is approximated using a spheroid (also called an ellipsoid of revolution)

Datums

  • A datum is a spheroid with an origen point and orientation aligning it for a particular use.

Image Source: Manny Gimond

  • A local datum uses matches a geoid to an ellipsoid to fit a local context, e.g.
    • NAD27 (North American Datum of 1927) is widely used in the U.S., especially in older maps.
    • ED50 (European Datum of 1950) is common in Western Europe.

Image Source: Manny Gimond

  • A geocentric datum aligns the centroid of the geoid to the center of the ellipsoid

Image Source: Manny Gimond

Projections

  • Mathematical formulas for transform 3D Earth to 2D map
  • i.e. project the latitude and longitude to x any coordinates on a plane
  • There are infinite ways to do this, they all cause distortion

Projections

Imagine a lightbulb inside of the earth, shining out and projecting the shadows of the continents onto a developable surface (flattenable surface).

There are three commonly used developable surfaces

  • plane
  • cone
  • cylinder
  • The developable surface can be oriented in many ways.
  • Each developable surface can be in one of two cases tangent and secant
  • The aspect of the projection is the orientation of the developable surface relative to the axis of the earth

Tissot’s indicatrix

Shows linear, angular, and areal distortions of maps

Equidistant projections

  • Maintains distance between points in one direction (usually north-south)
  • Angles and shapes are not preserved
  • Good for small-scale maps that cover large areas
  • Often used for global thematic maps

Conformal map projections

  • Preserve angles (also known as bearings) between locations
  • Used for navigational purposes
  • Areas tend to be quite distorted
  • Shapes are more or less preserved over small areas, at small scales areas become wildly distorted
  • e.g. Mercator projection (with normal aspect) is famous for distorting Greenland

Equal area or equivalent projections

  • Preserve area
  • Distort angles

Weird projections

  • Often made as compromises between types of distortion
  • Like the Waterman Butterfly

Left: circles of equal area on globe. Right: same circles on Mercator projection.

Top: True-color satellite image of Earth in equirectangular projection.
Bottom: Equirectangular projection with Tissot’s indicatrix.


Top: Nautical Chart of Lake Superior in Mercator projection. Bottom: Mercator projection.

Real-time Waterman Wind Map

UTM

Universal Transverse Mercator (UTM)

  • a projection and accompanying projected coordinate system
  • Divided into 60 narrow zones
  • Does not cover polar regions
  • Large north-south extent with low distortion

Image Source: wikimedia

  1. Open QGIS
  2. Use QuickMapServices to add a global Satellite coverage layer.
  3. In the drop down menus, go to Project –> Preferences then select the CRS tab on the left
  4. In the filter box type “26910”
  5. Under Predefined Coordinate Reference Systems select NAD83 / UTM zone 10N
  6. Click Apply and OK

State Plan System

Each State Plane Coordinate System zone uses a map projection based on its geographic orientation.
e.g.

  • Transverse Mercator Projection
  • Lambert Conformal Conic Projection
  • Hotine Oblique Mercator Projection

  • Reproject the global satellite image from the last slide to EPSG:2227 (California zone 3)
  • Scroll to zoom in on South Africa. What do you notice?

Spatial Data Models and Formats

Data Overview

What are Data?

  • “Facts, measurements, and characteristics of something of interest.”
  • “Facts and statistics collected together for reference or analysis.”

What is Information?

  • “Facts provided or learned about something or someone.”
  • “Knowledge and insights that are acquired through the analysis of data.”

What are Spatial Data?

  • “Data that describe the geographic and spatial aspects of phenomena.”
  • “Facts and statistics collected together for reference or analysis.”

What are Metadata?

  • Data about the data
  • Ex: units, what instruments were used, who/what/when/where/how the data was collected

Data Types

  • Data can have different types

    • Ex: How might “population” data differ from “county” data?
  • The most common types of data available for use in a GIS are:

    • Bools - True / False statements (think off/on switch)

    • Strings - Alphanumeric text denoted by quotes (e.g. “Lake Tahoe”)

    • Numbers - numerical values (e.g. latitude/longitude coordinates)

      • Integers (ints) - numerical values (8 bit or 16 bit precision)
      • Floating Points - negatives, decimal values (32 bit precision)

Data Types - Continuous vs Discrete

  • Continuous data consists of numerical values
  • Discrete data consists of a limited number of possible values, groups, or categories

Levels of Measurement

  • Nominal - Names or identifiers of objects
  • Ordinal - Ranked categories based on a measure
  • Ratio - have a 0 value that indicates absence of the quantity of interest
    • e.g. Mass, distance, Temperature in Kelvins
  • Interval - have a regular scale, but not a meaningful 0 value
    • e.g. Date, temperature in C or F

Ratio - Multiplication makes sense, e.g. 200 K is twice as hot as 100 K \[ 2 \times 100 \mathrm{K} = 200 \mathrm{K} \]

Interval - Multiplication does not make sense, e.g. 200°C is not twice as hot as 100°C \[ 2 \times 100°\mathrm{C} \neq 200°\mathrm{C} \]

Image Source: wikimedia

Geospatial Data Types: Vector vs. Raster

Vector Data

  • Can be described by points, lines, polygons
    • Ex: roads, rivers, train tracks, hiking trails, sidewalks, building footprints, county boundaries
  • NOT images, do NOT contain any pixels
  • The kind of data we’ve been working with so far

  • Stored as tabular data files with geographic metadata
  • Points, lines, and polygons represent the spatial features
  • Topology describes the connectivity, area definition, and contiguity of interrelated points, lines, and polygon

Points

  • Zero-dimensional objects containing a single coordinate pair.
    • Ex: Lat/Lon coordinates denoting a city, building, address, etc
  • X,Y coordinates on a cartesian plane

Lines

  • One-dimensional objects composed of multiple, explicitly connected points.
  • Lines have the property of length.
  • Also called an “arc.”

Polygons

  • Two-dimensional features created by multiple lines to create a “closed” feature.
  • First point on the first line segment is the same as the last point on the last line.
  • Can represent city boundaries, buildings, lakes, soils, etc.
  • Have the properties of area and perimeter.

Structuring Vector Data

  • There are several ways to define relationships between vector data:
    • Feature based: The “Spaghetti Model”

      • Each feature is a long string of coordinates
      • No relationships between features
    • Structured: The “Topological Model”

      • Enforced relationships between features

Some Common Vector File Formats

Format File Extension Stores Topology Binary / Human Readable Notes
Shapefile .shp (+ .shx, .dbf, .prj) No Binary Common, but aging
GeoJSON .geojson, .json No Human Readable Web-friendly, text-based
GeoPackage .gpkg No Binary Modern SQLite-based format
KML/KMZ .kml, .kmz No Human Readable (.kml) / Binary (.kmz) Google Earth format
TopoJSON .topojson Yes Human Readable json, Encodes topology
PostGIS (database) Yes (optional) Binary PostgreSQL spatial extension
File Geodatabase .gdb Yes (optional) Binary ESRI proprietary format, annoying to use in other software
GeoParquet .parquet No Binary Column-oriented, efficient

How to open gdb in QGIS

  1. Download 3D Hydrography Program data for the CONUS

    gdb
    metadata(Optional)

  2. Unzip the zip. (Unless you plan to use it later, you can just unzip it into the Downloads folder where the zip sits)

  3. Press ctrl-shift-v (cmd-shift-v on Mac)

    1. At the top, under “source type”, check the directory box.
    2. Browse for and select 3dhp_all_CONUS_20250313_GDB.gdb where you unzipped it.
    3. Click Add

Discussion

  • What vector type (point, line, or polygon) best represents the following features:

    • state boundaries,
    • telephone poles,
    • buildings,
    • cities,
    • stream networks,
    • mountain peaks,
    • soil types,
    • flight tracks?
  • Which of these features can be represented by multiple vector types?

  • What conditions might lead you choose one vector type over another?

Raster Data

  • Derived from a grid-based system of contiguous cells containing specific attribute information.
  • The spatial resolution of a raster dataset represents a measure of the precision or detail of the displayed information.
  • Widely used by technologies such as digital images and LCD monitors.

  • Images, stacks of images (satellite / drone image)
    • Raster (latin) means “screen”!
  • Grids of numbers
  • Things with pixels!
  • If it’s pixelated:
    • It’s a raster
  • If it’s a photo:
    • It’s a raster
  • If it’s a digital image
    • It’s a raster!

  • The spatial resolution of a raster dataset represents a measure of the precision or detail of the displayed information.
    • AKA pixel size
    • Ex: 1mm, 1cm, or 1m
  • So when you hear that a camera has N megapixels - this just means it has many millions of pixels

Spatial Resolution

The spatial resolution of a raster dataset represents a measure of the accuracy or detail of the displayed information.

The spatial resolution of a raster dataset represents a measure of the accuracy or detail of the displayed information.

Spectral Resolution

Image Source: Neon

Image Source: Neon

Image Source: Neon

Image Source: NASA

Image Source: University of Texas at Austin, Center for Space Research via ESA

Finding, Acquiring, Creating, and Editing GIS Data

as well as

Introduction to Spectral Indices

Finding GIS Data

Tutorial - Copernicus Browser

  • Open Copernicus Browser (right click to open in new tab)

  • First, make an account!

    • registration is free and helps track use of the tool (and manage processing quotas)

You should see something like this when it first opens:

To register, click the “Login” button at the top of the left panel

Follow the steps to register, confirm your email, and then go back to the main page.

Now let’s get a feel for what the tool can do!

Look at the Garnet Fire on CalFire inciweb.

  • In Copernicus Browser (in visualize mode), paste the lat, lon into the search, hit enter
  • Change the date to 2025-09-07
  • Adjust image so the fire is in view

  • Lets try a different visualization
  • Copernicus offers a SWIR based composite visualization that is quite good for burn detection.

  • That is a nice way to visualize but for actual detection purposed using a spectral index is better
  • Normalized Burn Ratio (NBR) is the most obvious choice here. \[ \begin{align} NBR &= \frac{NIR - SWIR2}{NIR + SWIR2} \\ &= \frac{B8 - B12}{B8 + B12} \mathrm{For Sentinel 2} \end{align} \]

Exercise - Create and download a NBR geotiff for before and after the fire.

Spectral Indices

Index Formula Sentinel-2 Purpose
NDVI (NIR - Red) / (NIR + Red) (B8 - B4) / (B8 + B4) Vegetation health
NDWI (Green - NIR) / (Green + NIR) (B3 - B8) / (B3 + B8) Water detection
NDMI (NIR - SWIR1) / (NIR + SWIR1) (B8 - B11) / (B8 + B11) Vegetation moisture
NBR (NIR - SWIR2) / (NIR + SWIR2) (B8 - B12) / (B8 + B12) Burn severity
NDSI (Green - SWIR1) / (Green + SWIR1) (B3 - B11) / (B3 + B11) Snow cover
SAVI 1.5 × (NIR - Red) / (NIR + Red + 0.5) 1.5 × (B8 - B4) / (B8 + B4 + 0.5) Soil-adjusted veg.

For more indices / detail see Montero et al. (2023) Sci Data 10:197

Tutorial - Google Earth Engine

Another incredibly powerful tool at our disposal is Google Earth Engine

  • Cloud-based, so it can handle high intensity data processing

  • Free1 access to a large collection of datasets

Step One - Registering for GEE

  • We want to register a new project

  • Name your project something useful, then hit create
  • Next, we want to register the project for non-commercial use

This will take you to a form where you can confirm your eligibility. Here’s an example of how to fill it out:

Now let’s go back to the Code Editor.

These are the main panels to be aware of:

Step Two - Editing and Running a Script

  • In the scripts panel, select New > File and name it something useful
  • You should see it show up under the Owner dropdown:
  • Click on the file to open it, and then move to the Code Editor. It should be blank to start.

  • Let’s try running some code! In the editor window, type the following command:
  • Then hit run. Look at the console - what do you see?

Now let’s try something a little more complicated:

// Note - lines that start like this (//) are comments, meaning they won't be run like regular code

// These are the 5 largest cities in the world: 
// Tokyo, Delhi, Shanghai, Mexico City, Sao Paulo

// Create a list named 'largeCities' with the names of all the above cities

var largeCities = ['Tokyo', 'Delhi', 'Shanghai', 'Mexico City', 'Sao Paulo']; 

// Print the list 

print(largeCities)

Copy the code above and paste it into your code editor, hit run, and explore the output in the console.

Next, we’re going to explore some spatial data.

  • In the search bar at the top of page, type in “California Polytechnic State University”
  • Click on the search result, and the map view should update accordingly

Add a marker to the map by clicking this icon:

Place the point somewhere in the middle of campus:

  • At the top of the code editor, you should now see a new var called “geometry”, which gives us the coordinates of our point

  • We can now reference the point in new lines of code, like we did with “largeCities”

  • To add in other data layers, let’s look in the Earth Engine Data Catalog
  • Using the search bar, find the Sentinel-2 Dataset and click on the Level-1C option
  • Scroll down to the “Explore with Earth Engine” section, and copy the JavaScript code
  • Go back to the code editor, and paste the code onto a new line

Before we run it, let’s make a few changes to the code.

  • First, let’s change these dates to be more recent:

  • Pick a month in 2025, and set the dates to be the first and end of the month
  • Next, let’s change the center point of the map to the point we dropped earlier:

  • Replace the entire line with the following code:
Map.centerObject(geometry, 12);
  • Alternatively, you can just replace the first two numbers with the coordinate values saved to “geometry”

Hit run, and watch what happens in the map viewer! It may take a second for the layer to load.

What is this code doing?

  • The quality of satellite imagery can be significantly affected by the cloud cover on any given day
  • To compensate for this, it can be helpful to generate a composite image of only the days with clear visibility over a month

  • From here, we could clip (or mask, in the case of raster images) the Sentinel image to a set boundary by uploading a shapefile or geojson
  • We can also export map layers, which will be saved to our Google Drive

Google Earth Engine QGIS Plugin

There is also a GEE plugin for QGIS!

We can do the same operation we just did through the plugin:

Week 3 Announcements

Events

Final Project Brainstorm

Due October 15th

Come up with your own geospatial analysis idea. Submit a well thought out paragraph which describes:

  1. The question/problem you have identified
  2. The geographic data you will use to answer the question
  3. The geoprocessing steps you will perform on the data
  4. The expected outputs of your analysis

You may also frame your question as a hypothesis test (as in the Scientific Method)

  • Submit 1 pdf per group.
  • If you are having a hard time coming up with an idea come to me.

Vector Operations

Buffer

  1. Open QGIS and open the ‘sprStreams.geojson’
  2. Vector –> Geoprocessing tools –> Buffer

Notice the Units! Buffering in degrees makes no sense. Reproject it first! What is a good projection?

Dissolve

  1. In QGIS open sprSoil.geojson
  2. Change symbology to categorical by “SOILNAME”
  3. Vector –> Geoprocessing tools –> Dissolve
  4. Use “HYDROGRPOUP” as dissolve field

Clip

  1. Vector –> Geoprocessing tools –> Clip
  2. Clip the sprSoil by the streams buffer.

Spatial overlays

  1. Intersect soils with bufffer, look at attributes
  2. Intersect buffer with soils, look at attributes

Union

Symmetric Difference

  • Try it with buffer and soils

Check topology Vector --> Geometry --> Check Validity

Link to tutorial about editing vectors.

Joins

Tabular joins join layers by matching a common column name (e.g., parcel_id or GEOID)

Spatial joins transfer attributes based on how features relate in space (intersects, within, nearest)

Tabular Joins

  1. Download California Counties and median household income

  2. add the counties layer

  3. add the income csv (you must select “no geometry (attribute only table)”)

  4. Open the attribute tables for each look at the names for the columns containing county name

  5. In the Processing Toolbox search :join” and select “join attributes by field”

    • Input layer 1 is counties, input layer 2 is
    • use appropriate column names
  6. Look at the attribute table of the resulting layer

  7. Change the symbology to make a thematic map showing median income by county.

Spatial Joins

One-to-One Spatial Join

  • Output: Each feature from the target layer (the primary layer) gets a single matching record from the join layer (secondary layer).

  • Handling Multiple Matches: If multiple matches are found, only one matching feature is selected (usually the first or based on criteria like nearest neighbor).

  • Example:Joining cities (target) with climate zones (join layer), ensuring each city gets only one associated climate zone. One-to-Many Spatial Join

  • Output: If multiple matching features exist, the target feature is duplicated for each matching feature from the join layer.

  • Handling Multiple Matches: Every matching record from the join layer is included, leading to multiple rows for one target feature.

  • Example: Joining states (target) with cities (join layer). Each state will appear multiple times for every city within its boundaries.

Merge vs Spatial Join

Spatial Join:
You might use a spatial join to combine data from a “census tracts” layer with a “crime incidents” layer to see the crime statistics within each census tract.

Merge:
You might use a merge to combine two adjacent land parcels into a single, larger parcel with a new boundary.

Spatial Joins

Download Cities

  • Use the “join attributes by location” tool from the geoprocessing toolbox to join cities to counties
  • Why someone would do this particular join I don now know, but it illustrates the point.
  • There will be problems. Hint: “validate geometries and”fix geometries” tools will be useful.

Challenge - Figure out how to join counties to cities, and calculate total urban area for each county.

Vector and Raster Data

Finding Acquiring, Creating, and Editing GIS Data

GeoProcessing and Vector Operations

Geospatial Data: Satellites, UAVs, GPS

Spectral Indices and Tabular Joins

Spatial Joins, Final Project Discussion

Spatial Analysis Introduction, Final Project Group Discussions

Spatial Analysis: Map Algebra, Reprojection, Resampling

Raster Vector Operations, Zonal Statistics, Point Sampling

Rasterizing by Attributes, Georeferencing, Statistics 101

ArcGIS Pro, Spreadsheets

Web Mapping, Field Data Collection: Mobile sensors and edge devices

Photogrammetry, Radar, Interferometry