Skip to content
LocusQ

pg2osm

What it is

Converts a LocusQ schema v2 database into OSM XML or PBF, the single input TileGen and Router read.

The output extension picks the format: .osm.pbf writes PBF, .osm writes XML. --tables limits a run to some of the nine families.

Rows that produce no OSM output go to dropped_rows.csv with a reason, so rows in = features out + dropped rows + unknown terms. A run that fails a check leaves a .rejected file, never the output.

The image bundles osmium-tool and runs as the unprivileged user locusq (uid 10001). Output, run report and database config live in one mounted directory.

Install

The repositories and packages are private while LocusQ is in private release. Ask for access and say which tools you need.

Build the image

bash
docker build -t locusq-pg2osm:0.3.0 .

Prepare the output directory

Input databases must follow Schema v2.2.0 or newer, and vocabulary.yaml must be 2.2.0 or newer.

bash
mkdir -p out && chmod a+rwx out          # the image user (uid 10001) writes here
cp config/database.yaml out/             # your DB config (see database.yaml.example)

Convert

bash
docker run --rm --network host \
  -v "$PWD/out:/out" \
  -v /path/to/locusq-schema/vocabulary.yaml:/vocabulary/vocabulary.yaml:ro \
  locusq-pg2osm:0.3.0 convert --config config/master_mapping.yaml \
  --db-config /out/database.yaml --output /out/country.osm.pbf

Minimal usage

Check the database connection before a long run. It checks PostGIS and lists every spatial table with its row count:

bash
locusq-pg2osm test-connection --db-config config/database.yaml

Product page: pg2osm. Release notes: Changelog.