Press "Enter" to skip to content

Building Plausible Random Geographies with PostGIS

Dian M Fay has fun building a map:

Squaria is a continent of highly unstable geography defined by a single SQL query (with, as we’ll see, many, many CTEs). Its only consistent properties at the moment are its boxy shape and the two unnervingly straight mountain ranges that cross its breadth and meet on its lower eastern edge. Those mountains are impossible, but today’s topic is fluviation, that is, rivers and riverine lakes; we’ll see about plausible plate tectonics some other time, maybe.

The ever-shifting border of Squaria is defined by a Voronoi diagram within a 100-unit envelope, similar to Paul Ramsey’s random polygon generation. Other shapes are of course easily achievable, and I’m probably going to steal his circular envelope outright in the future, but squares are easy to demo.

Read on to see how Squaria got its geographic features.