postgis_tiger_geocoder

PostGIS tiger geocoder and reverse geocoder

Overview

PackageVersionCategoryLicenseLanguage
postgis3.6.2GISGPL-2.0C
IDExtensionBinLibLoadCreateTrustRelocSchema
1500postgisNoYesNoYesNoNo-
1501postgis_topologyNoYesNoYesNoNotopology
1502postgis_rasterNoYesNoYesNoNo-
1503postgis_sfcgalNoYesNoYesNoYes-
1504postgis_tiger_geocoderNoYesNoYesYesNotiger
1505address_standardizerNoYesNoYesNoYes-
1506address_standardizer_data_usNoYesNoYesNoYes-
Relatedpostgis fuzzystrmatch pgrouting pointcloud pointcloud_postgis h3 h3_postgis q3c ogr_fdw geoip

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG3.6.21817161514postgispostgis, fuzzystrmatch
RPMPGDG3.6.21817161514postgis36_$v-
DEBPGDG3.6.21817161514postgresql-$v-postgis-3-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PGDG 3.6.1PGDG 3.6.1PGDG 3.6.1PGDG 3.6.1PGDG 3.6.1
el8.aarch64PGDG 3.6.1PGDG 3.6.1PGDG 3.6.1PGDG 3.6.1PGDG 3.6.1
el9.x86_64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
el9.aarch64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
el10.x86_64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
el10.aarch64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
d12.x86_64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
d12.aarch64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
d13.x86_64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
d13.aarch64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
u22.x86_64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
u22.aarch64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
u24.x86_64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2
u24.aarch64PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2PGDG 3.6.2

Install

You can install postgis directly. First, make sure the PGDG repository is added and enabled:

pig repo add pgdg -u          # Add PGDG repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install postgis;          # Install for current active PG version
pig ext install -y postgis -v 18  # PG 18
pig ext install -y postgis -v 17  # PG 17
pig ext install -y postgis -v 16  # PG 16
pig ext install -y postgis -v 15  # PG 15
pig ext install -y postgis -v 14  # PG 14
dnf install -y postgis36_18       # PG 18
dnf install -y postgis36_17       # PG 17
dnf install -y postgis36_16       # PG 16
dnf install -y postgis36_15       # PG 15
dnf install -y postgis36_14       # PG 14
apt install -y postgresql-18-postgis-3   # PG 18
apt install -y postgresql-17-postgis-3   # PG 17
apt install -y postgresql-16-postgis-3   # PG 16
apt install -y postgresql-15-postgis-3   # PG 15
apt install -y postgresql-14-postgis-3   # PG 14

Create Extension:

CREATE EXTENSION postgis_tiger_geocoder CASCADE;  -- requires: postgis, fuzzystrmatch

Usage

PostGIS TIGER Geocoder: US Census TIGER/Line geocoding for PostGIS

The PostGIS TIGER Geocoder provides geocoding and reverse geocoding capabilities for US addresses using US Census TIGER/Line data. It can parse an address string into a normalized form, find the geographic coordinates, and reverse-geocode coordinates back to an address.

Setup

CREATE EXTENSION postgis_tiger_geocoder CASCADE;

This creates the tiger schema with the geocoder tables and functions.


Loading TIGER Data

Before geocoding, TIGER/Line data must be loaded for the states you need. The extension provides helper functions to generate the loading scripts:

-- Generate a script to download and load data for a state
-- (e.g., Massachusetts = 'MA')
SELECT loader_generate_script(ARRAY['MA'], 'sh');

This generates a shell script that uses shp2pgsql to load TIGER shapefiles. Run the generated script to populate the tiger_data schema with address ranges, edges, faces, and other data.

After loading:

-- Install missing indexes for performance
SELECT install_missing_indexes();

-- Update statistics
ANALYZE tiger.addr;
ANALYZE tiger.edges;
ANALYZE tiger.faces;

Geocoding

Convert a US address string to geographic coordinates:

-- Basic geocoding
SELECT g.rating, ST_X(g.geomout) AS lon, ST_Y(g.geomout) AS lat,
       pprint_addy(g.addy) AS address
FROM geocode('1600 Pennsylvania Ave NW, Washington, DC 20500') AS g;

The rating indicates match quality (lower is better, 0 = exact match).

-- Geocode with a limit on results
SELECT g.rating, ST_AsText(g.geomout), pprint_addy(g.addy)
FROM geocode('100 Main St, Boston, MA', 3) AS g;

-- Batch geocode from a table
SELECT a.id, g.rating, g.geomout, pprint_addy(g.addy)
FROM addresses a, LATERAL geocode(a.address_string, 1) AS g;

Reverse Geocoding

Convert coordinates back to a street address:

SELECT pprint_addy(r.addy[1]) AS address
FROM reverse_geocode(ST_SetSRID(ST_MakePoint(-77.0365, 38.8977), 4326)) AS r;

Address Normalization

Parse and normalize address strings without geocoding:

SELECT *
FROM normalize_address('1600 Pennsylvania Avenue NW, Washington, DC 20500');

Returns components: address (number), predirAbbrev, streetName, streetTypeAbbrev, postdirAbbrev, internal, location (city), stateAbbrev, zip, parsed.

-- Pretty-print a normalized address
SELECT pprint_addy(normalize_address('100 main street boston ma 02101'));

Configuration

The tiger.geocode_settings table controls geocoder behavior:

-- View current settings
SELECT * FROM tiger.geocode_settings;

-- Adjust settings (e.g., increase debug level)
UPDATE tiger.geocode_settings SET val = 'true' WHERE name = 'debug_geocode_address';

Last Modified 2026-03-12: add pg extension catalog (95749bf)