跳转到主要内容

postgis_tiger_geocoder

PostGIS tiger geocoder and reverse geocoder

postgis_tiger_geocoder : PostGIS tiger geocoder and reverse geocoder

Overview

ID Extension Package Version Category License Language
1504 postgis_tiger_geocoder postgis_tiger_geocoder 2025.2 GIS GPL-2.0 PLpgSQL
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
----dt- No No No Yes no yes
Relationships
Schemas tiger
Requires postgis fuzzystrmatch
See Also nominatim_fdw geoip tzf pg_geohash ogr_fdw
Pigsty fills EL8 gaps.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PGDG 2025.2 18 17 16 15 14 postgis_tiger_geocoder postgis, fuzzystrmatch
RPM PGDG 2025.2 18 17 16 15 14 postgis_tiger_geocoder_$v -
DEB PGDG 2025.2 18 17 16 15 14 postgresql-$v-postgis-tiger-geocoder -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 2025.2 PIGSTY 2025.2 PIGSTY 2025.2 N/A N/A
el8.aarch64 PIGSTY 2025.2 PIGSTY 2025.2 PIGSTY 2025.2 N/A N/A
el9.x86_64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
el9.aarch64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
el10.x86_64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
el10.aarch64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
d12.x86_64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
d12.aarch64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
d13.x86_64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
d13.aarch64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
u22.x86_64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
u22.aarch64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
u24.x86_64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
u24.aarch64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
u26.x86_64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
u26.aarch64 PGDG 2025.2 PGDG 2025.2 PGDG 2025.2 N/A N/A
Package Version OS ORG SIZE File URL
postgis_tiger_geocoder_18 2025.2 el8.x86_64 pigsty 123.0 KiB postgis_tiger_geocoder_18-2025.2-1PGSTY.el8.noarch.rpm
postgis_tiger_geocoder_18 2025.2 el8.aarch64 pigsty 123.0 KiB postgis_tiger_geocoder_18-2025.2-1PGSTY.el8.noarch.rpm
postgis_tiger_geocoder_18 2025.2 el9.x86_64 pgdg 104.4 KiB postgis_tiger_geocoder_18-2025.2-1PGDG.rhel9.8.noarch.rpm
postgis_tiger_geocoder_18 2025.2 el9.aarch64 pgdg 104.3 KiB postgis_tiger_geocoder_18-2025.2-1PGDG.rhel9.8.noarch.rpm
postgis_tiger_geocoder_18 2025.2 el10.x86_64 pgdg 104.5 KiB postgis_tiger_geocoder_18-2025.2-1PGDG.rhel10.2.noarch.rpm
postgis_tiger_geocoder_18 2025.2 el10.aarch64 pgdg 104.5 KiB postgis_tiger_geocoder_18-2025.2-1PGDG.rhel10.2.noarch.rpm
postgresql-18-postgis-tiger-geocoder 2025.2 d12.x86_64 pgdg 94.9 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg12+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 d12.aarch64 pgdg 94.9 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg12+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 d13.x86_64 pgdg 95.1 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg13+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 d13.aarch64 pgdg 95.1 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg13+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 u22.x86_64 pgdg 95.0 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg22.04+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 u22.aarch64 pgdg 95.0 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg22.04+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 u24.x86_64 pgdg 95.1 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg24.04+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 u24.aarch64 pgdg 95.1 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg24.04+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 u26.x86_64 pgdg 95.0 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg26.04+1_all.deb
postgresql-18-postgis-tiger-geocoder 2025.2 u26.aarch64 pgdg 95.0 KiB postgresql-18-postgis-tiger-geocoder_2025.2-1.pgdg26.04+1_all.deb
Package Version OS ORG SIZE File URL
postgis_tiger_geocoder_17 2025.2 el8.x86_64 pigsty 123.0 KiB postgis_tiger_geocoder_17-2025.2-1PGSTY.el8.noarch.rpm
postgis_tiger_geocoder_17 2025.2 el8.aarch64 pigsty 123.0 KiB postgis_tiger_geocoder_17-2025.2-1PGSTY.el8.noarch.rpm
postgis_tiger_geocoder_17 2025.2 el9.x86_64 pgdg 104.4 KiB postgis_tiger_geocoder_17-2025.2-1PGDG.rhel9.8.noarch.rpm
postgis_tiger_geocoder_17 2025.2 el9.aarch64 pgdg 104.3 KiB postgis_tiger_geocoder_17-2025.2-1PGDG.rhel9.8.noarch.rpm
postgis_tiger_geocoder_17 2025.2 el10.x86_64 pgdg 104.6 KiB postgis_tiger_geocoder_17-2025.2-1PGDG.rhel10.2.noarch.rpm
postgis_tiger_geocoder_17 2025.2 el10.aarch64 pgdg 104.5 KiB postgis_tiger_geocoder_17-2025.2-1PGDG.rhel10.2.noarch.rpm
postgresql-17-postgis-tiger-geocoder 2025.2 d12.x86_64 pgdg 94.9 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg12+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 d12.aarch64 pgdg 94.9 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg12+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 d13.x86_64 pgdg 94.9 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg13+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 d13.aarch64 pgdg 94.9 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg13+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 u22.x86_64 pgdg 95.1 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg22.04+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 u22.aarch64 pgdg 95.1 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg22.04+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 u24.x86_64 pgdg 94.9 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg24.04+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 u24.aarch64 pgdg 94.9 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg24.04+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 u26.x86_64 pgdg 94.9 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg26.04+1_all.deb
postgresql-17-postgis-tiger-geocoder 2025.2 u26.aarch64 pgdg 94.9 KiB postgresql-17-postgis-tiger-geocoder_2025.2-1.pgdg26.04+1_all.deb
Package Version OS ORG SIZE File URL
postgis_tiger_geocoder_16 2025.2 el8.x86_64 pigsty 123.0 KiB postgis_tiger_geocoder_16-2025.2-1PGSTY.el8.noarch.rpm
postgis_tiger_geocoder_16 2025.2 el8.aarch64 pigsty 123.0 KiB postgis_tiger_geocoder_16-2025.2-1PGSTY.el8.noarch.rpm
postgis_tiger_geocoder_16 2025.2 el9.x86_64 pgdg 104.4 KiB postgis_tiger_geocoder_16-2025.2-1PGDG.rhel9.8.noarch.rpm
postgis_tiger_geocoder_16 2025.2 el9.aarch64 pgdg 104.3 KiB postgis_tiger_geocoder_16-2025.2-1PGDG.rhel9.8.noarch.rpm
postgis_tiger_geocoder_16 2025.2 el10.x86_64 pgdg 104.6 KiB postgis_tiger_geocoder_16-2025.2-1PGDG.rhel10.2.noarch.rpm
postgis_tiger_geocoder_16 2025.2 el10.aarch64 pgdg 104.5 KiB postgis_tiger_geocoder_16-2025.2-1PGDG.rhel10.2.noarch.rpm
postgresql-16-postgis-tiger-geocoder 2025.2 d12.x86_64 pgdg 95.0 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg12+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 d12.aarch64 pgdg 95.0 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg12+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 d13.x86_64 pgdg 95.0 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg13+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 d13.aarch64 pgdg 95.0 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg13+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 u22.x86_64 pgdg 94.9 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg22.04+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 u22.aarch64 pgdg 94.9 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg22.04+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 u24.x86_64 pgdg 95.2 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg24.04+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 u24.aarch64 pgdg 95.2 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg24.04+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 u26.x86_64 pgdg 94.9 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg26.04+1_all.deb
postgresql-16-postgis-tiger-geocoder 2025.2 u26.aarch64 pgdg 94.9 KiB postgresql-16-postgis-tiger-geocoder_2025.2-1.pgdg26.04+1_all.deb

Source

gitea.osgeo.org/postgis/postgis_tiger_geocoder

pig build pkg postgis_tiger_geocoder;		# build rpm/deb

Install

Make sure PGDG repo available:

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

Install this extension with pig:

pig install postgis_tiger_geocoder;		# install via package name, for the active PG version

pig install postgis_tiger_geocoder -v 18;   # install for PG 18
pig install postgis_tiger_geocoder -v 17;   # install for PG 17
pig install postgis_tiger_geocoder -v 16;   # install for PG 16

Create this extension with:

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';

表格阅读