19.4 AI and Machine Learning in GIS
Deep learning for imagery, LLMs for workflows, and the ML techniques reshaping geospatial.
Key takeaways
- Deep learning has become the state of the art for segmentation, classification, and feature extraction in imagery.
- Foundation models (Clay, Prithvi, SAM) accelerate Earth-observation workflows.
- LLMs are starting to generate spatial SQL, write analysis code, and assist with interpretation.
Introduction
The last five years have transformed GIS from rules-based pipelines to ML-augmented workflows. This lesson covers the techniques that matter now and where the field is heading.
Deep learning on imagery
Semantic segmentation
Classify every pixel into a class — a supercharged Module 14.5 classification. Architectures:
- U-Net — encoder-decoder; seminal for biomedical then remote sensing.
- DeepLabV3+ — atrous convolutions for multi-scale context.
- Segment Anything Model (SAM) — Meta's foundation model that segments anything with a click or prompt.
Object detection
Draw bounding boxes around objects (buildings, cars, ships):
- YOLO family — fast, often real-time.
- Faster R-CNN — older but accurate.
- DETR — transformer-based, newer.
Instance segmentation
Per-object pixel masks. Mask R-CNN is the classic; modern transformer variants dominate benchmarks.
Foundation models for Earth observation
Pre-trained on massive satellite-image datasets; fine-tunable for downstream tasks:
- Clay — open EO foundation model.
- Prithvi (IBM + NASA) — general EO.
- SatMAE — masked autoencoder for satellite images.
- SatlasPretrain — Allen AI.
Typical workflow: download foundation model weights; fine-tune on your domain with 50–500 labelled examples; deploy.
ML for classical GIS tasks
- Deforestation alerts — classify weekly image stacks.
- Building footprint extraction — now near-human on clear imagery.
- Road extraction — from imagery without OSM.
- Land cover mapping — Sentinel-2 + time series → high-resolution land cover.
- Poverty mapping — NN on satellite imagery + census.
- Species distribution modelling — random forests, gradient boosting.
Reproducible ML pipelines
- Data: Radiant MLHub, AWS Open Data, Microsoft Planetary Computer for labelled datasets.
- Training frameworks: PyTorch, TensorFlow.
- GIS-native: TorchGeo, Raster Vision,
rastervision,aicrowd-rv. - Infra: Google Colab, AWS SageMaker, Jupyter + GPU.
MLOps for geospatial
- Version data, models, and pipelines — DVC, MLflow.
- Track experiments — Weights & Biases.
- Containerise — Docker images with reproducible environments.
- Continuous evaluation — new data triggers model re-evaluation.
LLMs in GIS
Large language models are finding their way into spatial workflows:
- Generate SQL from natural-language spatial questions.
- Write scripts in GeoPandas or PostGIS from a description.
- Summarise datasets — metadata generation.
- Conversational analysis — "Atlas AI", GIS copilots.
ChatGPT / Claude / similar tools + spatial libraries = genuinely useful analyst assistants. They're not replacing GIS analysts but are changing what one analyst can do in a day.
Bias and fairness
Spatial ML inherits biases from training data:
- Urban areas are heavily labelled; rural are sparse.
- Developed world dominates; global south under-represented.
- Historical labels encode colonial biases (administrative boundaries).
Mitigation:
- Stratify training by region.
- Test on held-out regions.
- Report per-region accuracies, not just global.
- Involve domain experts from affected regions.
Interpretability
Black-box models are scary for decisions. Techniques:
- Grad-CAM / CAM — highlight which pixels drove a classification.
- SHAP — feature importance for tabular models.
- Partial dependence — effect of a single feature.
- Counterfactuals — "what change would flip the prediction?"
Use for:
- Building trust with stakeholders.
- Debugging model failures.
- Meeting regulatory requirements.
Ethical considerations
- Surveillance — high-resolution imagery + facial/vehicle recognition is invasive.
- Military / dual use — many EO AI tools have defence applications.
- Environmental justice — uneven coverage of analytical services.
- Displacement — entry-level GIS jobs increasingly automated.
The technology is morally neutral; deployment decisions are not.
A small worked pipeline
"Detect tree cover change in a rainforest":
- Pre-train U-Net on Sentinel-2 forest/non-forest labels.
- Fine-tune on a regional dataset with 300 labelled hectares.
- Infer over monthly Sentinel-2 composites for the study region.
- Threshold predictions at 0.5.
- Compute difference between months.
- Export patches larger than 0.5 ha as GeoJSON alerts.
15–20 hours of work; covers thousands of km² per month.
Self-check exercises
1. What's a "foundation model" in the context of Earth observation?
A large pre-trained model (usually a transformer or CNN encoder) trained on a huge corpus of satellite imagery in a self-supervised way. Downstream users fine-tune it for specific tasks (land cover, deforestation, building extraction) with dramatically less labelled data than training from scratch. Examples: Clay, Prithvi, SatMAE.
2. Why stratify training data by region?
Landscapes, architectural styles, vegetation, and human settlement patterns vary enormously. A model trained on US Midwest imagery often fails on South Asian cities because buildings, colours, and road patterns differ. Regional stratification in training data and evaluation reveals such biases and forces more robust models.
3. When would you NOT use deep learning for a GIS task?
When classical methods work: rules-based classification on coarse imagery, spatial statistics on vector data, route optimisation. Deep learning needs labelled data, compute, and expertise; if a simple buffer-overlay-reclassify pipeline answers the question, start there. Reach for ML when classical methods have hit diminishing returns.
Summary
- Deep learning is state-of-the-art for imagery segmentation and detection.
- Foundation models let small teams compete with big ones.
- LLMs are starting to generate spatial code and SQL.
- Bias, interpretability, and ethics are first-class concerns.
Further reading
- Reichstein et al. — Deep learning and process understanding for data-driven Earth system science (Nature, 2019).
- TorchGeo documentation.
- Radiant Earth Foundation — labelled datasets.
- Clay Foundation Model documentation.
Module 19: 3D, LiDAR & Emerging Topics
Answer these quick multiple-choice questions to check your understanding before moving on.