5.2.3. Command-line interface¶
impexp export-table [-hV] [--ade-extensions=<folder>] [-c=<file>] [-D=<char>] -l=<file> [--log-file=<file>] [--log-level=<level>] -o=<file> [--pid-file=<file>] [--plugins=<folder>] [--use-plugin=<plugin [=true|false]>[,<plugin[=true|false]>...]]... [[[-t=< [prefix:]name>[,<[prefix:]name>...]]... [--namespace=<prefix=name>[,<prefix=name>...]]...] [[-r=<version>] [-R=<timestamp[,timestamp]>]] [-i=<id>[,<id>...] [-i=<id>[,<id>...]]...] [-b=<minx, miny,maxx,maxy[,srid]>] [-s=<select>]] [[-T=<database>] -H=<host> [-P=<port>] -d=<name> [-S=<schema>] -u=<name> [-p[=<password>]]] [@<filename>...]
export-table command exports attributes of the
city objects stored in the 3D City Database in tabular form.
It corresponds to the table export operation
offered on the Table Export tab of the graphical user interface (see Section 5.2.2).
The command provides a range of options to adapt the export process.
In addition, you can also use the global options that are available
for all commands of the Importer/Exporter command-line interface
(see Section 4.9).
Specify the output file to use for storing the exported attribute data. Use
.csvas file extension to export the data as comma-separated values (CSV) file, which is also the default output format. Alternatively, you can export the data as Microsoft Excel (XLSX) file by choosing
.xslxas file extension.
Provide the template file to use for the export. The template file defines the layout and content for the output file. See Section 220.127.116.11 for more information.
Delimiter to use for separating values in the output CSV file. By default, a comma
,is used as delimiter. This option is ignored when exporting as XLSX file.
Query and filter options
export-table command offers additional options to define both thematic and spatial filters
that are used to restrict the export to a subset of the top-level city objects stored in
the 3D City Database.
Comma-separated list of one or more names of the top-level feature types to be exported. The type names are case sensitive and shall match one of the official CityGML feature type names. To avoid ambiguities, you can use an optional prefix for each name. The prefix must be associated with the official XML namespace of the feature type. You can either use the official CityGML namespace prefixes listed in Table 4.11. Or you can use the
--namespaceoption to declare your own prefixes.
Used to specify namespaces and their prefixes as comma-separated list of one or more
prefix=namepairs. The prefixes can be used in other options such as
Specify the version of the top-level features to use for the export. Allowed values are
all. When choosing
latest, only those features that have not been terminated in the database are exported, whereas
allwill export all features. You can also choose to export only features that were valid at a given timestamp using
ator for a given time range using
terminatedwill return all terminated features whereas
terminated_atwill select features that were terminated at a given timestamp. In all cases, timestamps must be provided using the
--feature-version-timestampoption. Further details about the feature version filter are available in Section 18.104.22.168.
One or two timestamps to be used with the
--feature-versionoption. A timestamp can be given as date in the form
YYYY-MM-DDor as date-time specified as
YYYY-MM-DDThh:mm:ss[(+|-)hh:mm. The date-time format supports an optional UTC offset. Use one timestamp with the
terminated_atvalues and two timestamps separated by comma with the
betweenvalue of the
Comma-separated list of one or more identifiers. Only top-level features having a matching value for their identifier attribute will be exported.
2D bounding box to use as spatial filter. The bounding box is given by four coordinates that define its lower left and upper right corner. By default, the coordinates are assumed to be in the same CRS that is used by the 3DCityDB instance. Alternatively, you can provide the database
sridof the CRS associated with the coordinates as fifth value (e.g.
4326for WGS84). All values must be separated by commas. The bounding box is evaluated against the GMLID column of the CITYOBJECT table.
Provide an SQL SELECT statement to be used as SQL filter when querying the database. In general, any SELECT statement can be used as long as it returns a list of database IDs of the selected city objects (see Section 4.5.3 for more information). You can also use an @-file to provide the SELECT statement (see Section 22.214.171.124).
Database connection options
The following options allow you to define the connection details that shall be used for establishing a connection to the 3D City Database. You can also use environment variables for this purpose (see Section 4.9.8).
Specify the database system used for running the 3DCityDB. Allowed values are
postgresqlfor PostgreSQL/PostGIS databases (default), and
oraclefor Oracle Spatial/Locator databases.
Specify the host name of the machine on which the 3DCityDB database server is running.
Specify the TCP port on which the 3DCityDB database server is listening for connections. The default value is
5432for PostgreSQL and
Specify the name of the 3DCityDB database to connect to. When connecting to an Oracle database, provide the database SID or service name as value.
Name of the database schema to use when connecting to the 3DCityDB. If not provided, the
citydbschema is used for PostgreSQL by default, whereas the schema of the user specified by the option
--db-usernameis used under Oracle.
Connect to the 3DCityDB database server as the user given by
Specify the password to use when connecting to the 3DCityDB database server. You can either provide the password as value for this option or leave the value empty to be prompted to enter the password on the console before connecting to the database. If you skip this option completely, the
impexptool will try to connect to the database without a password. If the database server requires password authentication and a password is not available by other means, the connection attempt will fail in this case.
$ impexp export-table -H localhost -d citydb_v4 -u citydb_user -p my_password \ -l my_template.txt -o my_attributes.xslx
Export attributes according to the provided
(see Section 126.96.36.199) for
all top-level city objects stored in the database. The attribute data
is stored in the
my_attributes.xslx file using XLSX as output format.
The 3DCityDB to connect to is supposed to be running on a PostgreSQL database on
the same machine. The connection will be established to the
with the user
citydb_user and the password
$ impexp export-table -H localhost -d citydb_v4 -u citydb_user -p my_password \ -t Building -b 13.3508824,52.4799281,13.3578297,52.4862805,4326 \ -D ; -l my_template.txt -o my_attributes.csv
Only export attributes of
Building features overlapping with the provided bounding box from the
database. The coordinates of the bounding box are given in WGS84. For this reason,
the fifth value
4326 of the
-b option denotes the SRID that is used
by the target database for the WGS84 reference system. The output format is CSV and
; is used as delimiter.
$ impexp export -H localhost -d citydb_v4 -u citydb_user -p my_password \ -s "select cityobject_id from cityobject_genericattrib \ where attrname='energy_level' and realval < 12" \ -l my_template.txt -o my_attributes.csv
Export attributes of all city objects satisfying the given SQL SELECT statement.