9bNine Bits

What Is PostGIS?

PostGIS is an open-source extension that turns PostgreSQL into a spatial database, adding geometry and geography data types, spatial indexes, and a large library of functions for storing, querying, and analyzing location data. It follows the OGC Simple Features specification, so spatial work happens through standard SQL rather than a separate query language. Mapping tools and location-aware applications built on PostgreSQL commonly use it for spatial storage and queries.
What Is PostGIS?

PostGIS is a spatial data type for PostgreSQL. Non-spatial types have functions that do things to them (substring(), trim(), cos() , etc.) and indexes to allow fast access (btrees). PostGIS provides the same facility around spatial data. Functions that do things with geometry (Buffer(), Contains(), Union(), Intersects()) and indexes for fast random access (rtrees).

  • GEOMETRY
    • POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINETRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CURVESTRING, CURVEPOLYGON, COMPOUNDCURVE
  • Indexes
    • R-TREE, linear-time algorithm
  • Functions
    • OpenGIS “Simple Features for SQL”
    • ISO SQL/MM
    • Over 300 functions
  • Open source
    • General Public License (GPL)
    • Open development and support

 

PostGIS uses “lightweight” implementations – using the minimum amount of bytes to express the geometries and indexes. This reduces the disk size, which is not important because disk is expensive (it is not) but because disk is slow. 100x slower than main memory. The more information you can get off of disk and into memory cache, the faster your system will run. So, small indexes are particularly important.

PostGIS has hundreds of functions, all the SFSQL ones, and lots more, that our users have recommended based on their experiences working with the spatial database. Many of these “extra” functions are functions you can only get by buying the most expensive Oracle Enterprise license to get access to full Oracle Spatial.

 

  • Speed
    • Lightweight geometry implementation
    • Lightweight indexes (50% size savings)
    • Linear time R-Tree
    • Row- level locking algorithm
  • Features
    • All OGC Simple Features for SQL, ST_Buffer()
    • Aggregates, ST_Collect(), ST_Union()
    • Extras, ST_AsGML(), ST_AsKML(), ST_AsSVG(), ST_BuildArea(), ST_LineMerge, ST_Transform()

 

The main reason to use PostGIS and PostgreSQL is the great location they have in the price/functionality space. PostGIS and PostgreSQL have lots of features, so they meet the needs of lots of potential users, and they do so at a price point that is far better than the proprietary alternatives. Unless the functionality of the proprietary alternatives is worth the extra cost, why use them?

 

 

[Reference] Refractions Research (PostGIS Case Studies)

 

Tags: Open Source , Oracle , PostGIS , PostgreSQL , Spatial

Common questions

Is PostGIS free to use?

Yes. PostGIS is open-source software and PostgreSQL itself carries its own open license, so there is no purchase or subscription needed to use either one.

What is the difference between the geometry and geography types in PostGIS?

The geometry type treats coordinates as flat, Cartesian points on a plane and is faster for projected, regional data. The geography type stores coordinates as longitude and latitude on a sphere or ellipsoid and calculates distances and areas along the curved surface, which is more accurate over long distances but costs more to compute.

Does PostGIS work with MySQL or other databases?

No. PostGIS is an extension built specifically for PostgreSQL. Other database engines have their own spatial extensions with similar function names based on the same OGC standard, but they are separate implementations and not directly compatible with PostGIS.

Do I need PostGIS just to store latitude and longitude?

Not strictly, since plain numeric columns can hold coordinates. But without PostGIS you lose spatial indexing, distance and containment functions, and coordinate system handling, so any location-based querying has to be written and optimized by hand.

Sources

  1. PostGIS Project Documentation
  2. PostgreSQL Official Documentation
  3. Open Geospatial Consortium, Simple Features for SQL

About this page

Last reviewed October 30, 2026 by the Nine Bits editors. Read our editorial policy or report an error.