IntroductionWhat Is PostGIS?PostGIS extends PostgreSQL
so that geospatial data can be stored, indexed, queried, and processed in
the database. It keeps location data beside ordinary relational data, so a
spatial query can use the same SQL, transactions, constraints, access
controls, backup tools, and application connections as the rest of a
PostgreSQL database.The main postgis extension adds:geometry for planar coordinate systems
and geography for geodetic coordinates on the
earth.Spatial indexes that let the PostgreSQL planner avoid
scanning every row when objects can be filtered by location.Functions for measurement, relationships, overlays,
geometry construction and editing, coordinate transformation, clustering,
and spatial data exchange.Support for common geospatial encodings and formats,
including WKT, WKB, GeoJSON, GML, KML, FlatGeobuf, Geobuf, and Mapbox
Vector Tiles.This makes PostgreSQL a spatial database: applications can ask both
ordinary questions and location-aware questions without moving data to a
separate GIS processing system. Desktop GIS, map servers, ETL tools, and
application frameworks can connect through normal PostgreSQL interfaces.What Is in the PostGIS Distribution?This manual documents the main PostGIS source distribution. Depending
on how PostGIS was built and packaged, it can provide several PostgreSQL
extensions and command-line tools:postgisThe core geometry and geography types, spatial indexes,
and most spatial functions.postgis_rasterRaster storage, analysis, loading, and export. Raster
support uses GDAL and can be omitted from a build.postgis_topologySQL/MM topology types and functions for models based on
shared nodes, edges, and faces.postgis_sfcgalAdditional 2D and 3D processing functions backed by the
optional SFCGAL library.Loaders and utilitiesshp2pgsql,
pgsql2shp, and raster2pgsql move
data between common file formats and PostGIS. Other utilities support
upgrades, profiling, and development.The source tree also contains internal libraries such as
liblwgeom and libpgcommon. They
are implementation layers shared by PostGIS components, not separately
released PostgreSQL extensions. Most users start by enabling the core
extension with CREATE EXTENSION postgis; see
for available components and build
options.The PostGIS Project FamilyThis manual covers the main postgis/postgis
distribution. The official
PostGIS source
organization also hosts or mirrors complementary projects. These
projects have their own release cycles, installation instructions, and
documentation; installing the core extension does not install them.Address
Standardizer parses and normalizes postal addresses. It moved from
the main PostGIS source tree to a separate repository for the PostGIS 3.7
development cycle.PostGIS
TIGER Geocoder provides United States address geocoding and reverse
geocoding using Census TIGER data. It is also maintained separately from
the main distribution.H3-pg
provides PostgreSQL bindings for the H3 hierarchical hexagonal indexing
system and interoperates with PostGIS.PostGIS
Java provides Java bindings for PostGIS types.Introduction
to PostGIS is the hands-on workshop maintained by the PostGIS
project.Other PostgreSQL spatial extensions can complement PostGIS while
remaining independent projects. For example,
pgRouting adds routing and
graph analysis. Use each project's own manual for its functions and support
policy.How to Use This ManualThe manual is both a guide to the PostGIS data model and the complete
reference for the SQL interface. Choose a starting point based on what you
are trying to do:If you are new to spatial SQLStart with the
Introduction
to PostGIS workshop for a tutorial, then use
to understand spatial
types, coordinate systems, validity, loading, and indexes.If you are installing or upgrading PostGISRead and
. Package-specific instructions
and supported release information are maintained on the
PostGIS
website.If you are writing spatial queriesRead for spatial
relationships and index-aware query patterns, and
for common performance problems.If you are connecting a desktop GISUse the client's current database documentation for its
user interface and supported geometry types. For example, the
QGIS
DB Manager lesson covers PostgreSQL connections, table layers,
SQL query layers, import, and export. A query layer should return a
stable unique identifier and a geometry column with a known SRID and
geometry type. Expensive read-only queries can be exposed through a
view or materialized view and indexed as appropriate.If you need a particular functionUse or
. Function pages state
accepted types, dimensional support, standards conformance, dependency
requirements, and version availability.If you use an optional componentSee ,
,
, or
.If something goes wrongCollect the versions reported by
and follow
. Check when
behavior differs between release lines.Standards SupportThis manual marks individual functions as compliant with spatial
standards so users can tell which behavior is portable and which behavior is
a PostGIS extension. PostGIS implements the
OGC Simple Features
for SQL model, including the geometry type, Well-Known Text (WKT),
Well-Known Binary (WKB), and the common spatial accessors, constructors,
predicates, and processing functions. PostGIS also implements many
SQL/MM Spatial
types and functions.PostGIS supports geometry families defined by later standards,
including SQL/MM curved geometry and OGC Simple Features Access 1.2
PolyhedralSurface, Triangle, and TIN. Support for these geometry families is
function-specific, and each function page documents the supported input
types and conformance level.PostGIS also includes widely used extensions and integrations.
Examples of PostGIS extensions include Extended WKT (EWKT), Extended WKB
(EWKB), SRID metadata in those extended formats, geography, and raster.
PostGIS also supports input and output exchange formats defined by other
standards, such as GeoJSON, GML, and KML. These features are documented
individually and should not be read as OGC Simple Features or SQL/MM
requirements unless the specific function or format says so.When the implementation intentionally differs from a standard, or when
a standard leaves behavior ambiguous, the relevant function page describes
the PostGIS behavior.
summarizes SQL/MM compliance and geometry-type support across
functions.Project and CommunityPostGIS began in 2001 as a spatial database research project at
Refractions Research. It is now an
OSGeo project
developed by contributors and organizations around the world. The Project
Steering Committee coordinates releases, project policy, and the general
direction of development. The complete contributor and sponsor record is in
at the end of this manual.The manual is the authoritative reference for the released SQL
interface. The project website and source tree provide the surrounding
material:Documentation
routes readers to getting-started instructions, versioned manuals, tips,
training material, and the FAQ.Community
lists mailing lists, chat, events, videos, and other support channels.Developer documentation
covers development environments, testing, coding style, internals,
maintenance, governance, releases, and website work.