#tile #3d #gltf #city #city-json #tileset #cityjson

app tyler

Create tiles from 3D city objects encoded as CityJSONFeatures

1 unstable release

0.3.0 Mar 17, 2023

#103 in Geospatial

Apache-2.0

340KB
3.5K SLoC

tyler

tyler creates tiles from 3D city objects.

As input, tyler takes CityJSON Features, where each feature is stored in a separate file.

As output, tyler can create:

Details of the 3D Tiles output:

Additional information about the internals of tyler you will find in the design document.

Installation

For the time being, tyler depends on the geoflow-bundle for converting CityJSONFeatures to glTF. Unless you want to install the geoflow-bundle yourself, we strongly recommend to use the provided docker image for running tyler, because it contains the geoflow-bundle.

Compiling from source

tyler is written in Rust and you need the Rust toolchain to compile it.

After downloading the source code from GitHub, navigate into the tyler directory and you can install tyler with cargo.

cargo install .

Usage

tyler is a command line application.

Use --help to see the help menu.

tyler --help

Execution logs are outputted to the console. You can control the loging level (debug, info, error) by setting the RUST_LOG environment variable. For instance turn on the debug messages.

RUST_LOG=debug tyler ...

Exporting 3D Tiles

An example command for generating 3D Tiles. The agrument details are explained in the text below.

tyler \
    --metadata metadata.city.json \
    --features features/ \
    --output /3dtiles \
    --3dtiles-implicit \
    --object-type LandUse \
    --object-type PlantCover \
    --object-type WaterBody \
    --object-type Road \
    --object-type GenericCityObject \
    --object-type Bridge \
    --object-attribute objectid:int,bronhouder:string \
    --3dtiles-metadata-class terrain \
    --grid-minz=-5 \
    --grid-maxz=300

Input data

  1. A main .city.json file, containing at least the CRS and transform objects.
  2. A directory (or directory tree) of .city.jsonl files, each containing one CityJSON Feature, including all its children City Objects.

--metadata

A main .city.json file, containing at least the CRS and transform objects, set by the argument.

--features

A directory (or directory tree) of .city.jsonl files, each containing one CityJSON Feature, including all its children City Objects.

For example:

tyler --metadata metadata.city.json --features /some/directory/

Output

--output

The output is written to the directory set in --output. For 3D Tiles output, it will contain a tileset.json file and tiles/ directory with the glTF files. In case of implicit tiling, also a subtrees/ directory is written with the subtrees.

During the operation of Tyler, also an input/ directory is created with text files, but this directory is removed with all its content after Tyler finished processing the tiles (except when debug mode is enabled).

CityObject type

CityJSON data can contain different types of CityObjects, like Building, PlantCover or Road. It is possible to only include the selected CityObject types in the tiled output. The CityObject types are selected with the --object-type argument. This argument can be specified multiple times to select multiple object types.

For example:

tyler … --object-type Building --object-type BuildingPart

3D Tiles metadata class

The 3D Tiles metadata specification uses the concept of classes to categorize features. With the --3dtiles-metadata-class argument it is possible to set the metadata class for the features in the 3D Tiles output. The metadata class works in conjunction with selecting the CityObject types. Such that one declares a metadata class for a set of CityObject types.

For example:

tyler … --3dtiles-metadata-class building --object-type Building --object-type BuildingPart

Level of Detail (LoD)

CityJSON can store city objects with multiple levels of detail. For each CityObject type, its LoD needs to be specified as well. This is the LoD defined in the input data. The LoD value for each CityObject type is set with the --lod-<cityobject type> arguments. The <cityobject type> is the CityJSON CityObject type, such as BuildingPart or LandUse. The arguments are lower-case, thus “BuildingPart” becomes “building-part” and “LandUse” becomes “land-use”. If the value of --lod-<cityobject type> is an empty string (this is the default), then Tyler will select the highest available LoD for the city object.

For example:

tyler … --lod-land-use 1 --lod-building-part 1.3

Attributes

Attributes on the glTF features are set with the --object-attribute argument. The argument takes the attribute name and attribute value type as its value. The attribute name and type are separated by a colon “:” and concatenated into a single string, such as “name:type”. The possible value types are “string”, “int”, “float”, “bool”. The --object-attribute argument can be specified multiple times to include multiple attributes.

For example:

tyler … --object-attribute bouwjaar:int --object-attribute objectid:int --object-attribute bagpandid:string --object-attribute bgt_type:string

Colors

Colors on the glTF features are set with the --color-<cityobject type> arguments. The <cityobject type> is the CityJSON CityObject type, such as BuildingPart or LandUse. The arguments are lower-case, thus “BuildingPart” becomes “building-part” and “LandUse” becomes “land-use”. The argument value is the hexadecimal rgb color value. For instance “#FF0000” is red.

For example:

tyler … --color-building-part #FF0000

Dependencies

~13–18MB
~233K SLoC