Skip to main content

CLI to process and manipulate CityJSON files

Project description

cjio, or CityJSON/io

License: MIT

Python CLI to process and manipulate CityJSON files. The different operators can be chained to perform several processing operations in one step, the CityJSON model goes through them and different versions of the CityJSON model can be saved as files along the pipeline.

Installation

It uses Python 3.5+ only.

To install the latest release:

pip install cjio

To install the development branch, and still develop with it:

git checkout development
virtualenv venv
. venv/bin/activate
pip install --editable .

Alternatively, you can use the included Pipfile to manage the virtual environment with pipenv.

Note for Windows users

If your installation fails based on a pyproj or pyrsistent error there is a small hack to get around it. Based on the python version you have installed you can download a wheel (binary of a python package) of the problem package/s. A good website to use is here. You then run:

pip3 install [name of wheel file]

You can then continue with:

pip3 install cjio

Usage

After installation, you have a small program called cjio, to see its possibities:

cjio --help

Commands:
  assign_epsg                Assign a (new) EPSG.
  compress                   Compress a CityJSON file, ie stores its...
  decompress                 Decompress a CityJSON file, ie remove the...
  export                     Export the CityJSON to another format.
  extract_lod                Extract only one LoD for a dataset.
  info                       Output info in simple JSON.
  locate_textures            Output the location of the texture files.
  merge                      Merge the current CityJSON with others.
  remove_duplicate_vertices  Remove duplicate vertices a CityJSON file.
  remove_materials           Remove all materials from a CityJSON file.
  remove_orphan_vertices     Remove orphan vertices a CityJSON file.
  remove_textures            Remove all textures from a CityJSON file.
  reproject                  Reproject the CityJSON to a new EPSG.
  save                       Save the city model to a CityJSON file.
  subset                     Create a subset of a CityJSON file.
  update_bbox                Update the bbox of a CityJSON file.
  update_textures            Update the location of the texture files.
  upgrade_version            Upgrade the CityJSON to the latest version.
  validate                   Validate the CityJSON file: (1) against its...

Pipelines of operators

The 3D city model opened is passed through all the operators, and it gets modified by some operators. Operators like info and validate output information in the console and just pass the 3D city model to the next operator.

$ cjio example.json subset --id house12 info remove_materials info save out.json
$ cjio example.json remove_textures compress info
$ cjio example.json upgrade_version save new.json
$ cjio myfile.json merge '/home/elvis/temp/*.json' save all_merged.json

Validation of CityJSON files against the schema

To validate a CityJSON file against the schemas of CityJSON (this will automatically fetch the schemas for the version of CityJSON):

$ cjio myfile.json validate

If the file is too large (and thus validation is slow), an option is to crop a subset and just validate it:

$ cjio myfile.json subset --random 2 validate

If you want to use your own schemas, give the folder where the master schema file cityjson.json is located:

$ cjio example.json validate --folder_schemas /home/elvis/temp/myschemas/

Example CityJSON datasets

There are a few example files on the CityJSON webpage.

Alternatively, any CityGML file can be automatically converted to CityJSON with the open-source project citygml-tools (based on citygml4j).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cjio-0.5.4.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cjio-0.5.4-py2.py3-none-any.whl (39.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cjio-0.5.4.tar.gz.

File metadata

  • Download URL: cjio-0.5.4.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for cjio-0.5.4.tar.gz
Algorithm Hash digest
SHA256 525f3aff19b557d23a808a01516dca98c7f1e60547cf54a8da3d4f707c6064d3
MD5 57f25f7dfbee9684e199cf94acd40de4
BLAKE2b-256 79365328dcbccfe543be639ae34005200315b9a8ad7f552e61512df889c51b7b

See more details on using hashes here.

File details

Details for the file cjio-0.5.4-py2.py3-none-any.whl.

File metadata

  • Download URL: cjio-0.5.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 39.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for cjio-0.5.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 71ea49eb6d4bc01f739161fd7ee6433e8f227fe6831538adc33a411933f61aba
MD5 b48cb5f13f2c9fd110bac0be90dce158
BLAKE2b-256 f7858704c939990049d7866e80d0a82fd233d3bffebb79b477de7275733a0042

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page