voxcity.exporter.geotiff

GeoTIFF export utilities for VoxCity 2D data layers.

Exports land cover, building height, DEM, and canopy height grids as conventional north-up, single-band GeoTIFF files in EPSG:4326.

Classes

GeoTIFFExporter

Exporter adapter to write a VoxCity object's 2D layers to GeoTIFF files.

Functions

export_grid_geotiff(grid, rectangle_vertices, ...[, ...])

Write a single 2D grid to a georeferenced, north-up GeoTIFF.

export_geotiffs(city, output_directory[, ...])

Export a VoxCity object's 2D layers as one GeoTIFF per layer.

Module Contents

voxcity.exporter.geotiff.export_grid_geotiff(grid, rectangle_vertices, meshsize, output_path, *, crs='EPSG:4326', dtype=None, nodata=None, color_table=None, category_names=None)[source]

Write a single 2D grid to a georeferenced, north-up GeoTIFF.

Parameters:
  • grid (2D array, VoxCity (nx, ny) grid indexed along the AOI’s) – side_1/side_2 axes (either order supported for axis-aligned AOIs).

  • rectangle_vertices (AOI geometry used for georeferencing.)

  • meshsize (AOI geometry used for georeferencing.)

  • output_path (destination .tif path (parent dirs created as needed).)

  • crs (output CRS string (default "EPSG:4326").)

  • dtype (optional output dtype; grid is cast to it before writing.)

  • nodata (optional nodata value written into the file.)

  • color_table (optional {int index: (r, g, b)} palette (categorical layers).) – Requires an integer dtype (e.g. “uint8”) – GDAL colormaps only support Byte/UInt16 bands.

  • category_names (optional {int index: str} or list[str] of class names.)

Returns:

str

Return type:

the written path.

voxcity.exporter.geotiff.export_geotiffs(city, output_directory, base_filename='voxcity', *, layers=DEFAULT_LAYERS, write_readme=True, **kwargs)[source]

Export a VoxCity object’s 2D layers as one GeoTIFF per layer.

Writes {base_filename}_{layer}.tif for each requested layer. Land cover is written as uint8 with an embedded color table + class-name tags; building height, DEM, and canopy height are float32 with NaN nodata (0 stays valid data). Missing layers are skipped with a warning.

When write_readme is true (the default) a README.md describing the exported files (layer table, georeferencing, land-cover classes, and how to open them) is also written to output_directory.

Returns a dict mapping written layer name -> path. When a README is written its path is included under the "readme" key.