PostGIS

Add maps and location intelligence to PostgreSQL.

Overview

PostGIS is an extension that adds support for geographic objects to PostgreSQL. You can store points, lines and polygons, and run spatial queries such as "which shops are within 2 km of this location?".

It is the foundation of many GIS and mapping applications and works with tools like QGIS, GeoServer and web map libraries.

Where it is used

  • Store locators and delivery apps
  • Fleet and asset tracking
  • Land, utility and city mapping
  • Environmental and agricultural analysis

Enable PostGIS

docker run --name postgis -e POSTGRES_PASSWORD=change-me -p 5432:5432 -d postgis/postgis

-- inside the database:
CREATE EXTENSION postgis;

SELECT name
FROM shops
WHERE ST_DWithin(location::geography,
                 ST_MakePoint(77.5946, 12.9716)::geography,
                 2000);

What you will cover

The key topics and features of PostGIS

Geometry & Geography Types

Store locations, routes and areas.

Spatial Functions

Distance, area, intersection and containment functions.

Spatial Indexes

GiST indexes for fast location queries.

Coordinate Systems

Transform between thousands of projections.

Raster Support

Work with raster data such as satellite images.

GIS Tool Integration

QGIS, GeoServer and web mapping libraries.