Read, write, and query CityJSON, CityJSONSeq, and FlatCityBuf 3D city model files.
Installing and Loading
INSTALL cityjson FROM community;
LOAD cityjson;
Example
-- Read a CityJSON file
SELECT * FROM read_cityjson('buildings.city.json');
-- Read a CityJSONSeq (line-delimited) file
SELECT * FROM read_cityjsonseq('buildings.city.jsonl');
-- Read a FlatCityBuf file
SELECT * FROM read_flatcitybuf('buildings.fcb');
-- Extract geometries as WKB at a specific Level of Detail
SELECT * FROM read_cityjson('buildings.city.json', lod=>'1.2');
-- Write query results to CityJSONSeq
COPY (SELECT * FROM read_cityjson('buildings.city.json'))
TO 'output.city.jsonl' (FORMAT cityjsonseq);
-- Inspect file metadata
SELECT * FROM cityjson_metadata('buildings.city.json');
About cityjson
The CityJSON extension provides table functions for reading and writing 3D city model files in CityJSON (.city.json), CityJSONSeq (.city.jsonl), and FlatCityBuf (.fcb) formats. CityJSON is a JSON-based encoding for 3D city models (buildings, terrain, vegetation, etc.) based on the CityGML data model.
Supported functions:
read_cityjson,read_cityjsonseq,read_flatcitybuf— table functions for querying city objectscityjson_metadata,cityjsonseq_metadata,flatcitybuf_metadata— inspect file headersCOPY ... TOwith formatscityjson,cityjsonseq, andflatcitybuf— write query results
Additional features:
- Automatic schema inference from CityJSON attributes
- LOD-based geometry extraction as WKB blobs via the
lodparameter - Support for CityJSON v2.0 and CityJSONSeq formats
For more information on the CityJSON format, see https://www.cityjson.org/.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| cityjson_metadata | table | NULL | NULL | |
| cityjsonseq_metadata | table | NULL | NULL | |
| read_cityjson | table | NULL | NULL | |
| read_cityjsonseq | table | NULL | NULL |
Overloaded Functions
| function_name | function_type | description | comment | examples | |—————|—————|————-|———|———-|
Added Types
| type_name | type_size | logical_type | type_category | internal | |———–|———-:|————–|—————|———-|
Added Settings
| name | description | input_type | scope | aliases | |——|————-|————|——-|———|