cli处理和操作cityjson文件
cjio的Python项目详细描述
cjio或cityjson/io
python cli来处理和操作CityJSON文件。 可以将不同的运算符链接起来,一步执行多个处理操作,cityjson模型将遍历这些运算符,cityjson模型的不同版本可以保存为管道沿线的文件。
安装
它只使用Python3.5+。
要安装最新版本:
pip install cjio
要安装开发分支,并继续使用它进行开发:
git checkout developmentvirtualenv venv. venv/bin/activatepip install --editable .
或者,可以使用包含的pip文件来管理带有pipenv的虚拟环境。
对于Windows用户的注释
如果由于pyproj或pyresistent错误而导致安装失败,则需要一个小技巧来解决。 根据您安装的python版本,您可以下载问题包的wheel(python包的二进制文件)。 一个好的网站是here。 然后运行:
pip3 install [name of wheel file]
然后您可以继续:
pip3 install cjio
用法
安装后,您将拥有一个名为cjio
的小程序,以查看其可能性:
cjio --helpCommands: 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...
运营商管道
打开的三维城市模型通过所有操作员传递,并由一些操作员进行修改。
像info
和validate
这样的操作符在控制台中输出信息,并将3d城市模型传递给下一个操作符。
$ 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
根据架构验证cityjson文件
根据schemas of CityJSON验证cityjson文件(这将自动获取cityjson版本的模式):
$ cjio myfile.json validate
如果文件太大(因此验证速度很慢),可以选择裁剪一个子集并验证它:
$ cjio myfile.json subset --random 2 validate
如果要使用自己的模式,请给出主模式文件cityjson.json
所在的文件夹:
$ cjio example.json validate --folder_schemas /home/elvis/temp/myschemas/
示例cityjson数据集
有几个example files on the CityJSON webpage。
或者,任何CityGML文件都可以通过开源项目citygml-tools(基于citygml4j)自动转换为cityjson。