Skip to content
LocusQ

From the LocusQ schema to OSM PBF

pg2osm reads the locusq.* tables and writes OSM XML or PBF, with tags from the shared vocabulary, admin boundaries, addresses, routes and turn restrictions. TileGen and Router read its PBF.

Data

0.3.0Free

01What it does

Convert every family, or a few

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

bash
locusq-pg2osm convert --config config/master_mapping.yaml \
  --db-config config/database.yaml --output output/final/country.osm.pbf
locusq-pg2osm convert --tables transport poi --output output/final/roads.osm   # some families only

Every dropped row is reported

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.

bash
locusq-pg2osm validate --input output/final/country.osm.pbf   # osmium check-refs -r
locusq-pg2osm stats --input output/final/country.osm.pbf      # node/way/relation counts

osmium bundled in the image

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.

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

02Install

Run pg2osm yourself

  1. Get access

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

  2. Build the image

    bash
    docker build -t locusq-pg2osm:0.3.0 .
  3. 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)
  4. 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

Turn your schema into a PBF

The guide covers the subcommands, reports and exit codes.