Key Points
Network Analysis
- Road networks are graphs of nodes (intersections) and edges (road segments)
-
ox.graph_from_placedownloads OpenStreetMap roads for any named place -
add_edge_speedsandadd_edge_travel_timeslet you route by time instead of distance -
nearest_nodes(longitude first),shortest_pathandroute_to_gdfcover most routing tasks - Network distance is more realistic than straight line distance for access studies
- Match the network type to the people you study, and choose an access measure (nearest facility, cumulative opportunities, service area) that fits the question
- Check snapping distances and edge effects, and remember that speeds are estimates without traffic
Spatial Autocorrelation with PySAL
- Spatial weights define who is a neighbor: Rook (edges), Queen (edges and corners), KNN (closest)
- Global Moran’s I gives one number for clustering across the whole map
- The permutation p-value tells you whether the pattern could be chance
- Local Moran’s I (LISA) locates hotspots, coldspots and outliers; always filter by p-value
- Many local tests produce false positives; use stricter cutoffs or FDR, and treat clusters as leads
- Results depend on the units (MAUP), the weights, small populations and edges of the study area
Spatial Clustering
- Reproject to meters before clustering so distances are real
- DBSCAN and HDBSCAN find dense hotspots of any shape and label scattered points as noise
- K-Means splits all points into k round zones; choose k with the elbow method
- Hierarchical clustering shows how groups merge, but is slow on large datasets
- Pick the method that matches your question: hotspots or zones
- Choose
epswith a k-distance plot and k with the elbow method or silhouette score - A dense cluster may reflect the population at risk, duplicate locations or reporting, not high risk
NDVI Analysis
- NDVI compares NIR and red reflectance; for Landsat 8 and 9 these are bands 5 and 4
- Convert Level-2 values to reflectance
(
value * 0.0000275 - 0.2) before computing NDVI -
rasterioreads and writes rasters; reuse the inputprofilewhen saving -
np.digitizeturns NDVI into classes; n breaks give n + 1 classes - Vegetation’s spectral signature (low red, high NIR) is what NDVI measures; normalizing reduces brightness effects
- Interpret NDVI with care: thresholds vary, dense canopies saturate, pixels mix, and clouds and seasons change the values