{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "45973fd5-6259-4e03-9501-02ee96f3f870", "metadata": {}, "outputs": [], "source": [ "# Copyright (c) TorchGeo Contributors. All rights reserved.\n", "# Licensed under the MIT License." ] }, { "cell_type": "markdown", "id": "9478ed9a", "metadata": { "id": "NdrXRgjU7Zih" }, "source": [ "# Introduction to Geospatial Data\n", "\n", "_Written by: Adam J. Stewart_\n", "\n", "In this tutorial, we introduce the challenges of working with geospatial data, especially remote sensing imagery. This is not meant to discourage practitioners, but to elucidate why existing computer vision domain libraries like torchvision are insufficient for working with multispectral satellite imagery." ] }, { "cell_type": "markdown", "id": "4cc902a5-0a06-4b02-af47-31b124da8193", "metadata": {}, "source": [ "## Common Modalities\n", "\n", "Geospatial data come in a wide variety of common modalities. Below, we dive into each modality and discuss what makes it unique." ] }, { "cell_type": "markdown", "id": "7d02bf4d-e979-4d41-bf70-e1b5a73bac2f", "metadata": {}, "source": [ "### Tabular data\n", "\n", "Many geospatial datasets, especially those collected by in-situ sensors, are distributed in tabular format. For example, imagine weather or air quality stations that distribute example data like:\n", "\n", "| Latitude | Longitude | Temperature | Pressure | PM$_{2.5}$ | O$_3$ | CO |\n", "| -------: | --------: | ----------: | -------: | ---------: | ----: | -----: |\n", "| 40.7128 | 74.0060 | 1 | 1025 | 20.0 | 4 | 473.9 |\n", "| 37.7749 | 122.4194 | 11 | 1021 | 21.4 | 6 | 1259.5 |\n", "| ... | ... | ... | ... | ... | ... | ... |\n", "| 41.8781 | 87.6298 | -1 | 1024 | 14.5 | 30 | - |\n", "| 25.7617 | 80.1918 | 17 | 1026 | 5.0 | - | - |\n", "\n", "This kind of data is relatively easy to load and integrate into a machine learning pipeline. The following models work well for tabular data:\n", "\n", "* Multi-Layer Perceptrons (MLPs): for unstructured data\n", "* Recurrent Neural Networks (RNNs): for time-series data\n", "* Graph Neural Networks (GNNs): for ungridded geospatial data\n", "\n", "Note that it is not uncommon for there to be missing values (as is the case for air pollutants in some cities) due to missing or faulty sensors. Data imputation may be required to fill in these missing values. Also make sure all values are converted to a common set of units." ] }, { "cell_type": "markdown", "id": "b0076503-57d4-4803-b7ba-dc6b96dd5cf8", "metadata": {}, "source": [ "### Multispectral\n", "\n", "Although traditional computer vision datasets are typically restricted to red-green-blue (RGB) images, remote sensing satellites typically capture 3–15 different spectral bands with wavelengths far outside of the visible spectrum. Mathematically speaking, each image will be formatted as:\n", "\n", "$$ x \\in \\mathbb{R}^{C \\times H \\times W},$$\n", "\n", "where:\n", "\n", "* $C$ is the number of spectral bands (color channels),\n", "* $H$ is the height of each image (in pixels), and\n", "* $W$ is the width of each image (in pixels).\n", "\n", "Below, we see a false-color composite created using spectral channels outside of the visible spectrum (such as near-infrared):\n", "\n", "