Spatial & Network Data

BASC0005 Quantitative Methods 2: Data Science and Visualisation

Ollie Ballinger

Outline

  1. Case Study: Grain Theft in Ukraine
  2. Vector Data
  3. Raster Data
  4. Analysing Spatial Data
  5. Networks

Questions

  • How does grain laundering work?
  • Which ships are involved?
  • Which companies are involved?
  • Can we follow the grain?
  • Where does it go?

Automatic Identification System (AIS)

Identifying STS in AIS data

A simple algorithm:

  • If two or more ships
  • Spend two or more hours
  • Within 500m of each other
  • Then link them together

Satellite detections + AIS

  • 33,273 satellite detections since 2021
  • Cross-referencing the satellite detections with AIS data shows close agreement.
    • Satellite image metadata used to filter AIS data ± 24h of the time when the image was taken, within 500m of the center of the detection.
    • Draught data from AIS used to infer direction of cargo transfer
  • However, instances of disagreement between AIS + RS data are interesting…

Vector Data

Polygon Data

Each row is an area; the geometry column holds its boundary:

Borough Population Pubs geometry
Hackney 280,000 2,300 POLYGON(…)
Camden 279,000 1,943 POLYGON(…)
Westminster 261,000 532 POLYGON(…)

Raster Data

Raster Data: Definition

  • Similar to a digital photograph. The entire area of the map is subdivided into a grid of tiny cells, or pixels. A value is stored in each of these cells to represent the nature of whatever is present at the corresponding location on the ground.
  • The major use of raster data involves storing map information as digital images, in which the cell values relate to the pixel colors of the image. To reproduce the image the computer reads each of these cell values one by one and applies them to the pixels on the screen.

Medium Resolution (Landsat 8, 30m/px)

High Resolution (Maxar, 50cm/px)

Extremely High Resolution (KH-11, 10cm/px)

Analytical Approaches

Arithmetic

  • Zonal Statistics
    • Vector-Vector
      • Calculate the number of vectors within another vector
        • e.g. count the number of tube stations (points) within each borough (polygon)
      • We can add attribute information;
        • E.g. calculate the average vote share in a 10km grid cell
    • Vector-Raster
      • Calculate the value of a raster within each polygon
        • e.g. Calculate the average pixel value of nighttime lights within each 10km grid cell
  • Raster math
    • Add/subtract/divide/multiply one raster by another
      • E.g. subtract nighttime lights imagery taken in 1992 from imagery taken in 2012 to see which areas have become more luminous
  • Algorithms

Broad Street Pump

  • During the 1854 cholera outbreak in London, Dr John Snow noticed a pattern in the spatial distribution of cases
  • Infections were concentrated around a single water pump on Broad Street, in Soho

Raster Math

  • E.g. Nighttime Lights data
  • Satellite images of the earth at night
    • Highly correlated with development indicators
  • Applications:
    • Assessing economic development
    • Gauging the extent of destruction during war
    • Identifying refugee camps
    • Tracking methane flaring from oil production
  • Demo

Regression

  • You can use spatial data to generate your own data for use in a regression
  • Using zonal statistics, you can generate a table in which each row is an areal unit (e.g. province, grid-cell, etc.)
  • But, beware of AUTOCORRELATION
    • Things that are closer together (both in space and time) have more in common than things that are farther away.
    • Statistical approaches generally assume that observations are independent.

What Is a Network?

The Vocabulary

  • Node (or vertex): a thing. Edge (or link): a relationship. Degree: how many edges a node has.
  • Directed: A → B isn’t B → A. Weighted: edges have a strength or cost.

Networks as Data

  • Adjacency matrix: a 1 where two nodes are connected. Good for maths, wasteful for big sparse networks.
  • Edge list: one row per edge. This is what you’ll usually load with pandas.
source target min
Gt Portland St Euston Sq 2
King’s Cross Euston Sq 2
King’s Cross Euston 2
Warren St Euston 1

A Few Hubs, Many Ordinary Nodes

The London Underground is regular: every station has 1–7 neighbours. Kerch is heavy-tailed: the median vessel has 6 transfer partners, the top 1% over 67, the busiest 115. Big bulk carriers act as hubs that many small ships load into

It’s a Small World

Kerch Random network
Average path length 3.3 2.95
Clustering coefficient 0.324 0.015
  • Compare with a random network with the same number of nodes and edges.
  • Paths are about as short, but clustering is ~20× higher: a ship’s partners also trade with each other.
  • Short paths + high clustering = a small world. Milgram (1967): ‘six degrees of separation’. Facebook (2016): 3.6.

Who Matters? Centrality

Degree: Who Has the Most Friends?

  • Degree = how many friends you have
  • H is a Year 12 mentor with 7, the most in the school
  • But six are new Year 7s who know nobody else
  • Lots of friends doesn’t mean well connected

Betweenness: Who Hears All the Gossip?

  • Gossip travels along the shortest chain of friends
  • B has only 3 friends, one in each group
  • Gossip between the Year 7s, the popular crowd and chess club all goes through B: 120 pairs
  • Remove B and the school splits in three

Which Ships Are Central?

  • Top 25 by degree: half bulk carriers, half general cargo. The busy loaders
  • Top 25 by betweenness: 40% tankers, vs 24% of all ships. Tankers are the brokers linking otherwise separate groups
  • Top 25 by eigenvector: 72% small general-cargo ships in the dense core
  • Different measures pick out different roles

The Broker in the Dark

  • The highest-betweenness vessel is a Russian crude tanker, the *Vladimir Monomakh*
  • Here it sits alongside another tanker that isn’t broadcasting AIS
  • Its draught drops (bottom): it has unloaded. The partner is invisible in the network
  • The network only contains what AIS can see

Does Centrality Flag Grain Ships?

  • The 15 vessels named in media reports: median at the 90th percentile by degree, 91th by eigenvector
  • 7 of 15 are in the top 10% by degree
  • Sanctioned vessels (purple) are mostly below the median: they transfer less, or less visibly
  • Centrality can prioritise investigation. It can’t prove anything

Finding Communities

Communities: Clustering for Networks

  • A community: many edges inside, few between
  • Groups nodes by their connections, not their features (feature-based clustering comes in Week 10)
  • Modularity: how much denser than chance (above ~0.3 is notable)
  • Louvain (2008): merge whatever raises modularity most
  • London Underground: 9 communities (Q = 0.76). No coordinates used, yet they’re geographic

Kerch Transfers Over Time

  • Transfers collapsed in March 2022, then rebounded to a record 811 in October 2022.
  • Next: which ships trade with which? Communities in the transfer network

Communities Are Cargo Markets

Colour = community; red rings = vessels named in grain reports

  • 721 vessels, 4,008 transfer pairs (2022-02 to 2023-08). Louvain: 7 communities, modularity 0.59.
  • The algorithm never saw vessel type, yet two communities are almost all tankers (97%, 87%)

Any Questions?

o.ballinger@ucl.ac.uk