Skip to content

tudelft3d/mrtools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mrtools

A Python CLI tool suite, made for the MultiRoofs project, for processing CityJSON files.

Tools

roofarea

The roofarea command processes CityJSON files containing Buildings (and BuildingParts) and adds a total_area_roof attribute to each CityObject. The value is calculated as the sum of areas of all surfaces semantically labeled as "RoofSurface".

If a building has no semantic information, total_area_roof is set to 0.0.

Installation

Install the package in development mode:

uv pip install -e .

Usage

Basic usage:

uv run mrtools roofarea input.city.json -o output.city.json

Verbose mode (shows processing details):

uv run mrtools roofarea input.city.json -o output.city.json --verbose

Example Output

Processing: data/3dbag_b2.city.json
✓ Processed 4 CityObjects
  NL.IMBAG.Pand.0503100000028341-0 (BuildingPart): 186.71 m²
  NL.IMBAG.Pand.0503100000028341 (Building): 0.00 m²
  NL.IMBAG.Pand.0503100000031927-0 (BuildingPart): 233.79 m²
  ... and 1 more objects
✓ Output written to: data/3dbag_b2_output.city.json

Geometry Support

The tool handles both geometry types found in CityJSON:

  • Solid geometry (e.g., Dutch 3DBAG): boundaries[shell][face][ring][vertex]
  • MultiSurface geometry (e.g., Montréal dataset): boundaries[face][ring][vertex]

Project Structure

mrtools/
├── src/
│   └── mrtools/
│       ├── __init__.py         # Package initialization
│       ├── cli.py              # Typer CLI interface with subcommands
│       ├── processor.py        # CityJSON processing logic
│       └── geometry.py         # Geometric calculations
├── data/                       # Sample CityJSON files
│   ├── 3dbag_b2.city.json
│   └── montréal_b4.city.json
├── tests/                      # Test files
├── pyproject.toml              # Project configuration
└── README.md

Unit tests

uv run pytest

Requirements

pip install typer pytest

  • Python >= 3.13
  • typer >= 0.12.0
  • pytest >= 9.0.2

About

MultiRoofs tools for processing CityJSON files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages