Welcome to CJDB’s documentation!

cj2pgsql CLI usage

Import CityJSONL to a PostgreSQL database

usage: cj2pgsql [-h] [-H DB_HOST] [-p DB_PORT] -U DB_USER [-W DB_PASSWORD] -d DB_NAME [-s DB_SCHEMA] [-I TARGET_SRID]
                [-x INDEXED_ATTRIBUTES] [-px PARTIAL_INDEXED_ATTRIBUTES] [-g] [-a | -o] [-e | -u]
                [file_or_directory]

Positional Arguments

file_or_directory

Source CityJSONL file or a directory with CityJSONL files. STDIN if not specified. If specifying a directory, all the *.jsonl files inside of it will be imported.

Default: “stdin”

Named Arguments

-I, --srid

Target coordinate system SRID. All 3D and 2D geometries will be reprojected.

-x, --attr-index

CityObject attribute to be indexed using a btree index. Can be specified multiple times, for each attribute once.

Default: []

-px, --partial-attr-index

CityObject attribute to be indexed using a btree partial index. Can be specified multiple times, for each attribute once. This index indexes on a condition ‘where {{ATTR_NAME}} is not null’. This means that it saves space and improves query performance when the attribute is not present for all imported CityObjects.

Default: []

-g, --ignore-repeated-file

Ignore repeated file names warning when importing. By default, the importer will send out warnings if a specific file has already been imported.

Default: False

-a, --append

Run in append mode (as opposed to default create mode). This assumes the database structure exists already and new data is to be appended.

Default: False

-o, --overwrite

Overwrite the data that is currently in the database schema. Warning: this causes the loss of what was imported before to the database schema.

Default: False

-e, --skip-existing

Check if the object with given ID exists before inserting, and skip it if it does. By default, the importer does not check existence for performance reasons, which means that importing the same object twice will result in an error.

Default: False

-u, --update-existing

Check if the object with given ID exists before inserting, and update it if it does. The old object will be updated with the new object’s properties.

Default: False

Database connection arguments

-H, --host

PostgreSQL database host

Default: “localhost”

-p, --port

PostgreSQL database port

Default: 5432

-U, --user

PostgreSQL database user name

-W, --password

PostgreSQL database user password

-d, --database

PostgreSQL database name

-s, --schema

Target database schema

Default: “public”