FIT5137 Chap.8 Spatial Data and PostGIS
Spatial Data and PostGIS
Spatial Data and PostGIS introduces geometries, coordinate reference systems and database operations that give location analytical meaning. Points represent positions, lines represent connected paths and polygons represent bounded areas with interiors and boundaries. The correct type depends on the phenomenon and question, not on which symbol is easiest to display.
Coordinates remain uninterpretable without their actual reference system, and assigning a label is different from transforming values into another system. Before querying, the chapter validates identifiers, geometry types, nulls, validity, reference identifiers and spatial extent. It distinguishes geographic coordinates from projected coordinates and requires distance or area outputs to carry justified units.
Loading is treated as an evidence process: input rows, accepted geometries, rejected records and known locations are checked, while duplicate identifiers and coincident coordinates are investigated as separate quality questions.
What this chapter covers
- 01
Model phenomena as points, lines or polygons
- 02
Preserve stable business identifiers beside geometry
- 03
Verify actual coordinate reference systems
- 04
Distinguish assigning metadata from transforming coordinates
- 05
Validate geometry type, emptiness and validity
- 06
Check extent against the expected operating region
- 07
Choose measurement methods and explicit units
- 08
Retain rejected rows and transformation lineage
Worked example · free
Audit a service-stop import
- 1Begin with 84 input rows and separate defect types before making a decision.
- 1Reject the 2 rows with impossible latitude because their points cannot be located reliably.
- 1Reject the 1 row without a stable stop identifier because it cannot be reconciled to operational activity.
- 2Do not reject the 6 rows in 3 coincident-coordinate pairs solely for sharing location; different stops can legitimately use one place.
- 1Accepted rows equal 84 minus 2 minus 1, which equals 81.
- 2Reconcile 81 accepted plus 3 rejected to 84 input rows, then validate geometry type, reference system and extent for accepted points.
Key terms
- Point geometry
- A zero-dimensional spatial object representing one coordinate location.
- Line geometry
- A connected sequence of coordinates representing a path or linear feature.
- Polygon geometry
- A bounded spatial object with an interior, boundary and exterior.
- Geographic coordinates
- Angular positions on a geographic reference framework, commonly expressed as longitude and latitude.
- Projected coordinates
- Planar coordinates created by a projection selected for a region and measurement purpose.
- Spatial extent
- The bounding range occupied by a layer, used to detect displacement and implausible coordinates.
Spatial Data and PostGIS FAQ
Why is a coordinate pair not enough?
The same numbers can indicate different locations under different reference systems and axis conventions. Geometry type and reference metadata provide meaning, while stable identifiers connect the feature to business records. Validate all three before analysis.
What is the difference between assigning and transforming?
Assigning a reference identifier declares the system in which coordinates already exist. Transforming computes new coordinate values in a target system. Relabelling untransformed values can make wrong locations appear authoritative and should not be used to fix a mismatch.
How should I choose a geometry type?
Choose the type needed by the analytical relationship. A station can be a point for proximity, a road a line for path and intersection, and a service zone a polygon for containment and area. A representative centre point cannot answer whether a location lies inside the original area.
What validates a spatial import?
Reconcile input, accepted and rejected rows; test stable identifiers, non-empty geometry, expected type, validity and actual reference system; inspect the bounding extent and compare several known locations. A successful load command proves syntax, not correct geography.
Assessment move
Use a metadata-first checklist. For every layer, record identifier, geometry type, actual reference system, coordinate unit, extent, validity and expected population. Sketch the phenomenon before choosing point, line or polygon. Practise distinguishing assignment from transformation and verify a transformed sample by known locations plus round-trip tolerance.
For measurements, write the unit beside the number and justify the method for the region. When a query returns nothing, inspect extent and reference compatibility before changing the threshold. Prepare three deliberately flawed imports: swapped axes, relabelled coordinates without transformation and a polygon layer loaded as representative points. Diagnose each from extent, known landmarks and the operation that fails.
Then create a duplicate-location case with distinct valid identifiers and a repeated-identifier case with changed coordinates. Explain why the first may be legitimate while the second needs history or error investigation. Keep rejected rows and source coordinates visible in every solution, because spatial repair without lineage is difficult to audit or reverse.
End by creating a small acceptance table with input count, accepted count, rejection reasons, geometry-type count, extent and three known landmarks. This table should let a reviewer judge loading fitness before seeing any downstream map. Add the rejected identifiers and reasons as an appendix so a suspicious feature can be traced without rerunning ingestion.