PostGIS is an extension for PostgreSQL that adds geometric data types and spatial indexing. This supports use cases like location mapping and spatial search (find restaurant locations within WXYZ geofenced area).

Data Formats

PostGIS data is typically encoded using WKT or GeoJSON at application level but stored in EWKB or “Extended Well Known Binary” format as described here

SRID

SRID is used to denote what coordinate system a given shape uses. This allows us to support different scales of coordinates and shapes in the same database if we want to.

The default SRID for latitude and longitude on earth (as used by GPS systems) is 4326.

PostGIS and Python w/ SQLAlchemy and SQLModel

See GeoAlchemy2