← the Lab

Processing a country's worth of raster

from the job geospatial pipelines Β· write-up

The problem

Earth-observation data is big, messy, and never stops arriving. A single satellite scene can be hundreds of megabytes of imagery, tagged with the time it was captured, the footprint on the ground it covers, and the spectral bands it recorded. Cover a whole country over months and you're looking at terabytes of these scenes, most of which you don't actually need for any given question. The naΓ―ve approach β€” download everything, process everything β€” melts the machine and the budget. The real work is answering spatial questions over that mountain without touching most of it.

This is my day-to-day: building the pipelines and interfaces that turn raw imagery and boundary data into clean, queryable products teams rely on. Kept general here β€” the shape of the work, not any specific dataset.

The principle: filter before you compute

Every expensive step should run on the smallest possible amount of data, and the cheap filters come first. Before a single pixel is read, scenes are narrowed by the three things that are cheap to check and eliminate the most: does the scene's footprint even intersect the region I care about, does its timestamp fall in my window, and is it too cloudy to be useful? A catalog (I work with the STAC standard for indexing imagery) lets me ask exactly that, so I search by area of interest and date range instead of by hand, and throw out the majority of scenes before any heavy processing starts.

region list→ resolve geometry→ catalog search→ clip + reduce→ write to PostGIS

Only the scenes that survive that funnel get the expensive treatment: reprojected to a common coordinate system, clipped to the exact region boundary, and reduced to the handful of values that actually matter downstream. Results land in a spatial database (PostgreSQL / PostGIS) with the right spatial indexes, so the front end can later ask "what's inside this boundary?" or "what changed over this period?" and get an answer in milliseconds instead of re-reading imagery.

What makes it hard at scale

The last mile

None of it matters if the result is unusable, so the processed data is exposed through service APIs that return map-ready GeoJSON, and rendered in React map dashboards where people filter and drill down by region and time. The goal across the whole chain is to make something genuinely heavy β€” terabytes of imagery β€” feel light and queryable to the person at the other end.

What good looks like

The result I'm chasing is that a question over a huge area returns in milliseconds, and adding more imagery makes the archive richer without making queries slower β€” because the heavy lifting already happened at ingest and the query only ever touches the pre-computed slice it needs. The other half of "good" is trust: every output should be traceable back to the scenes it came from, with gaps and bad data flagged rather than silently averaged away. A fast answer nobody trusts is worthless.

What I'm looking into next

The one-line version: don't process the mountain, index it β€” then only ever touch the slice a question actually needs.
Work with geospatial data? If you've built pipelines like this and have a sharper way to filter, resolve boundaries, or catch bad scenes early, I'd love to compare notes. Drop me your suggestions β†’
PythonSTACrasterio GeoPandasshapelyPostGIS REST / GeoJSONReactAWS
← back to the Lab