Learn

Geometry vs Geography in Spatial Databases

In spatial databases such as PostGIS, geometry uses a planar coordinate model in the stored CRS, while geography provides earth-aware measurements on longitude and latitude.

Geobble
advancedexplainerGeometry & Data Models

Explain the practical geometry-versus-geography trade-off in spatial databases without implying that either type is universally more accurate.

Geometry vs Geography in Spatial Databases

In spatial databases such as PostGIS, geometry and geography describe two different ways of interpreting spatial coordinates. Geometry performs spatial operations in the coordinate reference system attached to the data, using planar mathematics. Geography treats longitude and latitude as positions on the Earth and provides earth-aware distance and area calculations for supported operations.

Neither type is universally better. Geometry is flexible, supports a broad set of spatial functions and works naturally with projected CRSs. Geography can simplify measurements across large extents where choosing one regional projection would be awkward.

Geometry uses the stored coordinate space

A geometry column stores points, lines or polygons together with a spatial reference identifier. Spatial functions operate in that CRS.

If the geometry uses a projected CRS whose units are metres, planar distance and area calculations can return metres and square metres, although whether those results are suitable still depends on how the projection behaves over the study area.

If the geometry uses a geographic CRS such as EPSG:4326, the coordinate values are angular. A purely planar calculation then operates on degrees rather than automatically interpreting the Earth as an ellipsoid.

This is why a geometry in EPSG:4326 can be perfectly valid storage while still being the wrong input for a naive metre-based distance calculation.

Geography provides an earth-surface model

A geography type is designed for geodetic longitude-latitude data. In PostGIS, geography measurements such as distance and area can account for the Earth's curved surface and return linear or areal units without first choosing a local projected CRS.

That is useful when data span countries, continents or several UTM zones, since a service calculating distance between cities around the world can avoid switching projected CRSs for every region.

The convenience has trade-offs. Geography supports a more limited set of operations than geometry in some spatial databases, and earth-aware calculations can be more computationally expensive. Complex overlay and editing workflows are often more naturally expressed with geometry.

The same coordinates can produce different measurements

Consider two points stored as EPSG:4326 longitude and latitude.

As geometry, a planar distance function interprets the coordinate differences in the units of the CRS. Those units are degrees, so the result is not a ground distance in metres.

As geography, the database can calculate the earth-surface distance between those positions and return metres.

A third option is to transform the geometry into an appropriate projected CRS and calculate there. For a local project, this can be faster and can support a broader range of planar operations while keeping distortion within an acceptable range.

The correct method therefore follows the extent and workload rather than a rule that longitude-latitude data should always be cast to geography.

Geometry is usually stronger for local analytical workflows

Geometry is often the better working type when:

  • a suitable projected CRS is known;

  • the project is local or regional;

  • overlays, buffering, editing or topology functions are important;

  • performance matters across many repeated operations;

  • the data use a CRS that is not compatible with the database's geography model.

A municipal parcel database, for example, will often work most naturally in an authoritative local projected CRS. Area, intersection and distance can then be calculated in one consistent planar coordinate space chosen for that region.

Geography is useful when the Earth itself is the working surface

Geography is attractive when:

  • features are distributed globally or across several projection zones;

  • common questions are geodesic distance or area;

  • the source data already use longitude and latitude;

  • the available geography functions cover the workload;

  • selecting and managing many local projected CRSs would add unnecessary complexity.

A global point service answering "Which location is nearest?" is a classic case. The spatial question spans the Earth's surface rather than one local map plane.

Geography does not solve network distance

Earth-aware distance is still only one definition of distance.

A geography calculation can measure the shortest path over the ellipsoid between two positions, but it cannot tell you how far a driver must travel on roads, how long a pedestrian route takes or whether a river blocks movement; those questions require network or accessibility models.

This matters because a technically precise geodesic distance can still answer the wrong practical question.

Geometry does not make every projected measurement trustworthy

The opposite misconception is that projected geometry automatically produces correct metre-based answers.

A CRS can use metres while having unsuitable distortion for the study area. Web Mercator is a familiar example: its coordinates are metre-like projected units, but its scale varies strongly with latitude. A planar area computed directly in EPSG:3857 is therefore not a dependable ground-area calculation.

The geometry type supplies planar mathematics. The CRS determines how that plane relates to the Earth.

Storage type and analytical type can differ

A database does not always need one permanent choice for every operation.

A system can store canonical data as geometry in EPSG:4326 for interoperability, cast particular values to geography for global distance, and transform features into regional projected CRSs for local analysis. Another system may store local data directly in a projected geometry column and never need geography at all.

What matters is that the operation's mathematical model remains explicit.

Type does not replace metadata or data quality

Neither geometry nor geography can repair ambiguous coordinates, missing CRS information or inaccurate observations.

A geography distance can be mathematically correct while both input points are uncertain geocodes. A geometry overlay can be internally precise while the source boundary is outdated. The spatial type determines how the database computes; provenance and accuracy still determine what the result means.

References

  1. PostGIS Workshop — Geography. Explains the practical distinction between PostGIS geometry and geography types.

  2. PostGIS ST_Distance. Documents distance behaviour and units for geometry and geography inputs.

Related content