PostGIS is a spatial database extender for PostgreSQL object-relational database. It adds support for geographic objects allowing location queries to be run in SQL.
FROM city, superhero
WHERE ST_Contains(city.geom, superhero.geom)
AND city.name = 'Gotham';
In addition to basic location awareness, PostGIS offers many features rarely found in other competing spatial databases such as Oracle Locator/Spatial and SQL Server. Refer to PostGIS Feature List for more details.
Stable Branch User Documentation
This documentation is for the released branches and will contain corrections and errata as they are available
How It Works
PostGIS adds extra types (geometry, geography, raster and others) to the PostgreSQL database. It also adds functions and indexes that apply to those types. It does this by:
Building a C library that PostgreSQL can load into a
Binding the functions and structures in that library to SQL types and functions.
Since PostGIS is in C, it can make use of other libraries in C and C++, and it does so liberally. PostGIS depends on:
GEOS for many geometry processing algorithms
Proj.4 for coordinate re-projection functions
GDAL for raster processing and format support
LibXML2 for XML parsing
JSON-C for JSON parsing
SFCGAL for extended 3D support and additional geoprocessing algorithms