Foundations of Geospatial Analysis

Professor Adam Dennett - @adam_dennett

Bartlett Centre for Advanced Spatial Analysis, University College London

November 21, 2023

About Me

  • Professor of Urban Analytics @ Bartlett Centre for Advanced Spatial Analysis (CASA), UCL

  • Geographer by background - ex-Secondary School Teacher - back in HE for 16+ years

  • Taught GIS / Spatial Data Science at postgrad level for last 11 years

About this session

  • Whistle-stop tour of some of the key concepts relating to spatial data

  • An illustrative example analysing some spatial data in London - demonstrating the “spatial is special” idiom and how we might account for spatial factors in our analysis

  • All slides and examples are produced in RMarkdown using Quarto and R so everything can be forked and reproduced in your own time later - just go to the Github Repo link below

  • By the end I hope you’ll all leave with a better introductory understanding of why and how we should pay attention to the influence of space in any analysis

Key Geospatial Concepts

  • Where? (absolute)
  • Where? (relative)
  • Storing where - spatial data
  • How near or distant?
  • What scale?
  • What shape?

Where? (absolute)

  • Everything happens somewhere

    • We’re here: Wallspace, 22 Duke’s Road, Camden, London, England, *Europe, Northern Hemisphere, Earth

Where? (absolute)

  • How do we know exactly where?

XKCD - No, The Other One

Where? Coordinate Reference Systems

  • More reliable than names (that are rarely unique or reference fuzzy locations), are coordinates

  • The earth is roughly spherical and points anywhere on its surface can be described using the World Geodetic System (WGS) - a geographic (spherical) coordinate system

  • Points can be referenced according to their position on a grid of latitudes (degrees north or south of the equator) and longitudes (degrees east or west of the Prime - Greenwich - meridian)

  • The last major revision of the World Geodetic System was in 1984 and WGS84 is still used today as the standard system for references places on the globe.

Where? Coordinate Reference Systems

  • Projected Coordinate Reference Systems convert the 3D globe to a 2D plane and can do so in a huge variety of different ways

  • Most national mapping agencies have their own projected coordinate systems - in Britain the Ordnance Survey maintain the British National Grid which locates places according to 6-digit Easting and Northing coordinates

  • Every coordinate system can be referenced by its EPSG code, e.g. WGS84 = 4326 or British National Grid = 27700 with mathematical transformations to convert between them

Where? Describing and Locating Things with Coordinates

  • Once we have a coordinate reference system we can locate objects accurately in space

  • Most objects that spatial data scientists are concerned with (apart from gridded representations, which we will ignore for now!) can be simplified to either a point, a line or a polygon in that space

  • Polygons and lines are just multiple point coordinates joined together!

  • The examples on the right store geometries in the ‘well-known-text’ (WKT) format for representing vector (point, line, polygon) geometries

Storing where - managing spatial data

  • Impossible to talk about spatial data without mentioning the shapefile

  • Developed in the 1980s by ESRI and has become, pretty much, the de facto standard for storing and sharing spatial data - even though it’s a terrible format!

  • Shapefiles store geometries (shapes) and attributes (information about those shapes)

  • Not a single file, actually a collection of files

    • .shp - geometries

    • .shx - index

    • .dbf - attributes

    • +some others!

  • Superseded by LOTS of alternative formats - geojson (web), GeoPackage (everything) which do the same thing in better ways for different applications

Storing where - Simple Features

  • Simple Features - OGC (Open Geospatial Consortium) standard that specifies a common storage and access model for 2D geometries

  • 2 part standard:

    • Part 1 - Common Architecture defining geometries, attributes etc. via WKT

    • Part 2 - supports storage, retrieval, query and update of simple geospatial feature collections via SQL (structured query language – been around since the 1970s)

  • Simple Features implemented in most spatially enabled database management systems (e.g. PostGIS extension for PostgreSQL, Oracle Spatial etc.)

  • sf package in R enables storage of spatial data and attributes in a single data frame object

Where? Relative - Tobler’s First Law of Geography

“Everything is related to everything else, but near things are more related than distant things.”

  • This observation underpins much of what spatial data scientists do

  • Being able to locate something in space, relative to something else, allows us to:

    • explain why something may be occurring where it is

    • make better predictions about nearby or further away things

  • Underpins the whole Geodeomographics (customer segmentation) industry!!

Where? Relative - John Snow’s Cholera Map

Where? Relative - Defining ‘near’ and ‘distant’

  • Near and distant can mean different things in different contexts

    • the furthest one would travel to buy a pint of milk is somewhat different to furthest one might be willing to commute for a job
  • In spatial data science one way of separating near from distant can simply be to define their topological relationship - Dimensionally Extended 9-Intersection Model (DE-9IM) is the standard topological model used in GIS

  • Touching or overlapping objects = ‘near’

Where? Relative - Exploring Near and Distant

  • Near and distant in London
  • Map shows 2011 Census Wards in London, within Borough Boundaries
  • The Greater London Authority produced the London Ward Atlas - - which collates a range of demographic and economic indicators for each of these zones in the city