cjdb CLI#

This is the documentation of the cjdb cli. It can be used to import and export city.jsonl files to PostgreSQL.

cjdb#

cjdb [OPTIONS] COMMAND [ARGS]...

Options

-v, --version#

Get the current version

export#

Export a CityJSONL schema to a file.

Example for exporting all the objects in a schema:

cjdb export -H localhost -U myusername -d mydb -s myschema -p 5432 -o result.jsonl

Example for exporting a specific object in a schema:

cjdb export -H localhost -U myusername -d mydb -s myschema -p 5432 -o result.jsonl -q “SELECT 1 as id”

cjdb export [OPTIONS]

Options

-q, --query <query>#

SQL query with the ids of the objects to be exported.

-H, --host <host>#

PostgreSQL database host

-p, --port <port>#

PostgreSQL database port

-U, --user <user>#

PostgreSQL database user name

--password <password>#

PostgreSQL database user password

-d, --database <database>#

Required PostgreSQL database name

-s, --schema <schema>#

PostgreSQL database schema name

-o, --output <output>#

Name of the output file. Default name: ‘cj_export.city.json’

import#

Import CityJSONL files to a PostgreSQL database. Example of cli command:

cjdb import -H localhost -U myusername -p 5433 -d mydb -s myschema -f “/path/to/file.jsonl”

cjdb import [OPTIONS]

Options

-f, --filepath <filepath>#

Path to a CityJSONL file or a directory with CityJSONL files. If no path is specified, STDIN will be used.

-H, --host <host>#

PostgreSQL database host

-p, --port <port>#

PostgreSQL database port

-U, --user <user>#

Required PostgreSQL database user name

--password <password>#

PostgreSQL database user password

-d, --database <database>#

Required PostgreSQL database name

-s, --schema <schema>#

PostgreSQL database schema name

-I, --srid <input_srid>#

If no SRID is defined in the metadata of the file, use this flag to define a SRID for the geometries. If an SRID is defined in the metadata, this flag will overwrite it.

-x, --attr-index <indexed_attributes>#

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

-px, --partial-attr-index <partial_indexed_attributes>#

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.

-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.

--overwrite#

If the file has been imported before, delete all associated objects with this filename and reimport all objects in the file.

--transform#

Transform input geometries to the CRS of the existing schema