Skip to content
GEOSAT
← Back to blog
Open GIS
Open GIS2024-12-20GEOSAT8 min read

PostGIS for cadastre: a minimal model, geometry and quality controls

Build a cadastral pilot with stable keys, verifiable geometry and clear boundaries from a complete legal model.

Editorial review: 2026-09-23

PostGISQGISOpen GIS

PostGIS stores and queries geometry alongside relational data. A polygon table, however, is not a complete cadastral system and does not establish LADM-COL compliance. This guide creates a minimal laboratory for discussing keys, geometry and permissions. It contains neither real parcels nor ownership information.

Environment and synthetic data

Use a laboratory PostgreSQL database with PostGIS enabled by its administrator. Do not run the example in production: it creates a schema and table. Use a supported release and record the first query's output.

Code example
SELECT version(), PostGIS_Full_Version();
CREATE SCHEMA cadastre_lab;
CREATE TABLE cadastre_lab.parcels (
  id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  code text NOT NULL UNIQUE,
  status text NOT NULL CHECK (status IN ('draft', 'reviewed')),
  geom geometry(Polygon, 4326) NOT NULL,
  CHECK (ST_IsValid(geom))
);
INSERT INTO cadastre_lab.parcels (code, status, geom)
VALUES ('DEMO-001', 'draft', ST_GeomFromText(
  'POLYGON((-75.57 6.24,-75.569 6.24,-75.569 6.241,-75.57 6.241,-75.57 6.24))',4326));
SELECT code, ST_IsValid(geom), ST_SRID(geom),
       round(ST_Area(geom::geography)::numeric, 2) AS area_m2
FROM cadastre_lab.parcels;

Expect one row, valid geometry, SRID 4326 and a positive area in square metres. Casting to geography calculates on a geodetic model; an institutional workflow may require a different method or projection. Do not use this output as a parcel's legally established area.

Keys and meaning

The id identifies a technical row; code represents a synthetic business key. Do not change the business key when reloading data. In a real model, separate spatial units, rights, restrictions, sources and relationships according to applicable requirements. Define effective dates and traceability before allowing corrections.

A validity CHECK rejects some malformed geometries but does not detect overlaps between parcels, coverage gaps or disagreement with documents. Those rules need additional queries, tolerance criteria and accountable review. A valid geometry does not certify ownership or survey accuracy.

Connect QGIS

Create a connection through a PostgreSQL service and a read-only account. Open cadastre_lab.parcels, check its key, CRS and location. Enable editing only through an account and process intended for that purpose. Configure a status lookup in the form and retain the database constraint to protect writes from other clients.

Before migrating an inventory

Compare counts, duplicate keys, nulls, CRS, dimensions and multipart geometries. Test backup recovery and concurrent editing. Public users should not receive personal information merely because it shares a table with geometry: publish views containing only authorized attributes. Keep this minimal model as a laboratory and use project-specific regulatory requirements to design the final model.

Model a reviewable parcel workflow

Start from the decisions the organization makes. A polygon can represent a proposed boundary, an observation or an accepted spatial unit; those states should not be confused. For a pilot, name who can create a draft, who reviews geometry and who approves publication. Keep cadastral rights, documentary evidence and personal information outside a public map view unless the applicable access rules authorize disclosure.

The following separation is a design exercise, not a legal cadastral model:

ConcernPilot representationReason for separation
Spatial objectParcel identifier, geometry and statusStable map reference
ObservationInspection linked to the parcelSeveral observations can concern one parcel
SourceDocument reference and dateThe geometry must not erase its evidentiary origin
ReviewReviewer, decision and reasonAn edit and an approval are different actions
Public displayRestricted viewPublication should not expose every operational field

A schema that supports this separation can evolve without placing ownership information inside arbitrary polygon attributes. For Colombian institutional work, map the actual required model and delivery validation separately. This generic exercise neither implements LADM-COL nor establishes compliance with an authority's current requirements.

Extend the synthetic example with observations

Run this only after the earlier cadastre_lab.parcels example in the same disposable database. It creates a child table and one fictional observation. No person or real property is represented.

Code example
CREATE TABLE cadastre_lab.observations (
  id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  parcel_id bigint NOT NULL REFERENCES cadastre_lab.parcels(id),
  observed_at timestamptz NOT NULL,
  result text NOT NULL CHECK (result IN ('consistent', 'review')),
  note text NOT NULL
);
INSERT INTO cadastre_lab.observations
  (parcel_id, observed_at, result, note)
SELECT id, '2026-09-01T14:00:00Z', 'review',
       'Synthetic example: verify boundary source'
FROM cadastre_lab.parcels WHERE code = 'DEMO-001';

SELECT p.code, count(o.id) AS observation_count
FROM cadastre_lab.parcels AS p
LEFT JOIN cadastre_lab.observations AS o ON o.parcel_id = p.id
GROUP BY p.code;

Expect one observation for DEMO-001. The foreign key prevents a child from referencing a nonexistent technical parcel key. It does not prove that the observation belongs to the correct real-world parcel. The form, reviewer and source evidence still matter. Decide separately whether deleting a parcel is allowed; this example does not cascade deletion into observations.

Check overlaps without flagging shared boundaries

Two parcels sharing an edge may be correct. ST_Intersects alone returns true for that case and therefore is not a complete forbidden-overlap rule. The following candidate check uses an explicit interior-intersection condition and returns each pair once:

Code example
SELECT a.code AS parcel_a, b.code AS parcel_b
FROM cadastre_lab.parcels AS a
JOIN cadastre_lab.parcels AS b
  ON a.id < b.id AND a.geom && b.geom
WHERE ST_Relate(a.geom, b.geom, '2********');

For polygon inputs, the pattern asks for an area-dimensional intersection between interiors. The bounding-box condition narrows candidate pairs. With the single parcel in this lab, expect zero rows. Add a deliberately overlapping synthetic polygon in a separate practice copy and verify that it is detected. Do not run topology judgments against invalid geometry without first handling validity failures.

A complete production rule also needs tolerances, exclusions and a defined domain. Parcels on different floors, historical versions or different legal representations might legitimately overlap. A universal “delete all overlaps” operation would erase meaning. Likewise, detecting gaps requires a declared coverage boundary; empty space outside that boundary is not automatically an error.

Distinguish geometry area from an authoritative area

Keep separate names for measured geometry area and any area recorded in an authoritative source. A difference can reflect rounding, survey method, projection, capture quality or a documentary discrepancy. Overwriting the recorded value with a new calculation hides that difference.

For the example, ST_Area(geom::geography) provides a geodetic calculation in square metres. For a projected institutional workflow, document the projection and evaluate the relevant planar calculation instead. Define an absolute and, when appropriate, relative tolerance; inspect very small parcels where a relative percentage can become misleading. Never classify an area discrepancy as legal noncompliance based only on this tutorial.

Design the QGIS form around relationships

  1. Connect using a role that can read the tables and an explicit unique key for each layer.
  2. Load parcels and observations. Configure a relation from observations.parcel_id to parcels.id in project properties.
  3. Present the child records in the parcel form. Confirm that the user sees the parcel business code even though the relationship stores a technical key.
  4. Create a second observation for the same parcel and verify it appears without duplicating the parcel polygon.
  5. Attempt a disallowed result value through an authorized test client and confirm the database rejects it.

Give editors understandable feedback for constraint errors. A database that correctly rejects a change still produces a poor operational workflow if analysts cannot identify the invalid field or recover unsaved work. Test cancelled edits and rollback as well as successful saves.

Publish a restricted read model

Create views with the minimum approved fields. For example, a public pilot could expose code, status and geom while withholding observation notes. Use a distinct publication role; do not provide a server with the database owner account. Validate what a service actually serializes, because a hidden field in the QGIS form is still present in the underlying table.

A view also has limits. It does not automatically anonymize geometry, prevent inference, or replace a decision about whether the data can be published. Inspect downloads, identify responses and feature queries as well as the visual map. The GeoServer publication guide continues the service-side workflow.

Acceptance before calling the pilot a migration

QuestionRequired evidence
Are identities preserved?Source and destination business keys reconcile, including leading zeros
Are relationships usable?Known parcel returns the correct observations in the chosen client
Is geometry usable?CRS, dimensions, validity and agreed cross-feature rules pass
Are edits controlled?Read-only account cannot edit; editor cannot change prohibited fields
Is recovery practical?Fresh database restore opens in QGIS and returns expected records
Is publication bounded?Public responses contain only approved attributes and geometries

Test a failed edit and a failed restore rehearsal deliberately. A successful query against the original database says nothing about whether recovery works. Use the backup guide to define the recovery procedure and the downloadable lab for a separate asset-oriented synthetic example.

Does PostGIS replace an entire cadastral platform?

PostGIS supplies spatial storage and operations within PostgreSQL. A complete platform also needs the applicable data model, workflow, evidence management, identity, review, integration and operational support. Keep those responsibilities visible when comparing costs.

Can ArcGIS and QGIS use the same database?

Some PostgreSQL/PostGIS access patterns are possible, but support, editing and enterprise-geodatabase behavior depend on the exact client and server versions. Validate the contract in the coexistence guide; do not enable direct writes into an Esri-managed schema merely because a table is readable.

Specific references: PostGIS relation patterns, geometry validity, and PostgreSQL constraints.

Sources and documentation

Next step

Continue in the Open GIS collection. For a specific project, use the total-cost calculator and request an assessment.

Related articles