PostGIS is a supercharged version of PostgreSQL (a database) that understands geography. It stores points, lines, polygons, and can answer questions like "which houses are within 500 meters of this park?"
GeoServer can read directly from PostGIS. You'll learn two ways to connect: JNDI (a shared connection pool for big setups) and standard connection pooling (simpler, for smaller projects). Once connected, any table or view becomes a mappable layer.
Instead of publishing a whole table, you can publish a view — a saved query that returns only the rows and columns you want. For example: "only show schools in this district" or "only show trees taller than 5 meters."
A materialized view takes it further: it caches the results on disk, so queries run lightning‑fast. The trade‑off? You must refresh it when the data changes. You'll learn when to use each.
Earth is round; maps are flat. A Coordinate Reference System (CRS) is the rulebook for translating round‑Earth coordinates into flat‑map numbers. Different rulebooks (like EPSG:4326 or EPSG:3857) produce different results.
If two datasets use different CRS and you put them on the same map, they'll be misaligned — like two puzzle pieces that don't fit. You'll learn to reproject data so everything lines up perfectly.
Imagine searching for a word in a 1,000‑page book by reading every page. That's what a database does without an index. A spatial index (like GiST) is like a table of contents for geography — it jumps straight to the right area.
You'll create a GIST index on your geometry column, then benchmark a query before and after. The difference can be hundreds of times faster.
This is where everything comes together. Field workers submit Kobo forms → your script (from Module 4) pushes them into PostGIS → GeoServer automatically serves them as a map layer.
The result: a live map that updates as field data arrives. You'll set up triggers and views so GeoServer always sees the freshest data without you touching anything.
What if someone edits a survey response? You don't want to lose the old version — you want a history. PostGIS supports temporal tables and versioning patterns that track every change.
You'll learn two approaches: keeping an "audit table" of every update, and using incremental updates to only push changed rows to GeoServer instead of reloading everything.
Connect the dots: Install PostGIS (or use a cloud instance). Create a table with a geometry column, insert three points, and connect GeoServer to it. Publish the layer.
View builder: Create a SQL view that returns only rows where a "status" column equals "active." Publish it in GeoServer and confirm only active rows appear.
Materialize it: Turn your view into a materialized view. Time a query before and after, then refresh it and observe the change.
CRS detective: Load the same dataset in EPSG:4326 and EPSG:3857 in a map viewer. Zoom in and spot the differences. Then reproject one dataset to match the other.
Index race: Create a table with 10,000 random points. Run a "within 100 m" query without an index (note the time), then add a GiST index and run it again. Celebrate the speed.
Live pipeline: Chain your Module 4 script to insert into PostGIS, create a view in PostGIS, and publish that view in GeoServer. Submit a new Kobo form and refresh the map — see it appear!
By the end of this module, you'll be able to: connect GeoServer to PostGIS, build and publish SQL views, handle CRS and reprojection, add spatial indexes, run a live Kobo → PostGIS → GeoServer pipeline, and track changes with versioning.