PPOL 6805 / DSAN 6750: GIS for Spatial Data Science
Fall 2026
Wednesday, September 30, 2026
| 9IM | Interior | Boundary | Exterior |
|---|---|---|---|
| Interior | ![]() |
![]() |
![]() |
| Boundary | ![]() |
![]() |
![]() |
| Exterior | ![]() |
![]() |
![]() |
| 9IM | Interior | Boundary | Exterior |
|---|---|---|---|
| Interior | ![]() 2 |
![]() 1 |
![]() 2 |
| Boundary | ![]() 1 |
![]() 0 |
![]() 1 |
| Exterior | ![]() 2 |
![]() 1 |
![]() 2 |
| DE-9IM | Interior | Boundary | Exterior |
|---|---|---|---|
| Interior | 2 | 1 | 2 |
| Boundary | 1 | 0 | 1 |
| Exterior | 2 | 1 | 2 |
…And Then into a Tiny String
212101212
…And Then into an Infinitesimally-Small Point
st_overlaps() |
Interior | Boundary | Exterior |
|---|---|---|---|
| Interior | T |
* |
T |
| Boundary | * |
* |
* |
| Exterior | T |
* |
* |
0, 1, 2):
T: “True” (non-empty, st_dimension() >= 0)F: “False” (empty, st_dimension() == NA)*: “Wildcard” (Don’t care what the value is)st_overlaps(): T*T***T**, st_equals(): T*F**FFF*| English | Mask | 212101212 |
Result |
|---|---|---|---|
| “Disjoint” | FF*FF**** |
FALSE |
x not disjoint from y |
| “Touches” | FT******* |
FALSE |
x doesn’t touch y |
| “Touches” | F***T**** |
FALSE |
x doesn’t touch y |
| “Crosses” | T*T***T** |
TRUE |
x crosses y |
| “Within” | TF*F***** |
FALSE |
x is not within y |
| “Overlaps” | T*T***T** |
TRUE |
x overlaps y |
st_relate(): The Ultimate Predicateset.seed(6805)
N <- 10
africa_sf <- ne_countries(continent = "Africa", scale = 50) |> select(geounit, gdp_md)
africa_union_sf <- sf::st_union(africa_sf)
africa_map <- mapview(africa_sf, label="geounit", legend=FALSE, col.regions=cb_palette[2], alpha.regions=0.5)
sampled_points_sf <- sf::st_sample(africa_union_sf, N) |> sf::st_sf() |> mutate(temp_c = runif(N, 0, 100), pop=rdunif(N, 1, 1000))
sampled_points_map <- mapview(sampled_points_sf, label="Random Point", col.regions=cb_palette[1], legend=FALSE)
countries_points_sf <- africa_sf[sampled_points_sf,]
filtered_map <- mapview(countries_points_sf, label="geounit", legend=FALSE, col.regions=cb_palette[2], alpha.regions=0.5)
(africa_map + sampled_points_map) | (filtered_map + sampled_points_map)POINTs are not merged into attributes of POLYGONsPOINT attributes into single row?POLYGON Attributes
\(\overset{?}{\leftarrow}\)
POINT Attributes
st_join()Every point could be matched to one country. But what if… 😱
| Geographic Unit | Administered By | For | |
|---|---|---|---|
| Census Tracts | US Census Bureau | Demographic statistics | |
| We are in GeoID \(\overbrace{\underbrace{\large\texttt{11}}_{\small\text{State}}\underbrace{\large\texttt{001}}_{\small\text{County}}}^{\small\text{FIPS Code}}\overbrace{\underbrace{\large\texttt{0002}}_{\small\text{Number}}\underbrace{\large\texttt{01}}_{\small\text{Suffix}}}^{\small\text{Census Tract}}\): DC Census Tract 2.02 | |||
| ZIP Code™ | US Postal Service | Mail delivery | |
| We are in 20007 (20057 = Hilltop Campus West of 37th St NW!) | |||
| Topographic Quadrangles | US Geological Survey | Land resource management | |
| We are in Washington West Quadrangle | |||
Assume the extensive attribute \(Y\) is uniformly distributed over a space \(S_i\) (e.g., for population counts we assume everyone is evenly-spaced across the region)
We first compute \(Y_{ij}\), derived from \(Y_i\) for a sub-area of \(S_i\), \(A_{ij} = S_i \cap T_j\):
\[ \hat{Y}_{ij}(A_{ij}) = \frac{|A_{ij}|}{|S_i|}Y_i(S_i) \]
where \(|\cdot|\) denotes area.
Then we can compute \(Y_j(T_j)\) by summing all the elements over area \(T_j\):
\[ \hat{Y}_j(T_j) = \sum_{i=1}^{p}\frac{|A_{ij}|}{|S_i|}Y_i(S_i) \]
\[ \hat{Y}_{ij} = Y_i(S_i) \]
\[ \hat{Y}_j(T_j) = \sum_{i=1}^{p}\frac{|A_{ij}|}{|T_j|}Y_j(S_i) \]
PPOL 6805 Week 6: Spatial Joins and Interpolation