Skip to content

Vegetation Processors

Read and write the placed vegetation collection in its compact binary format. The placement and spacing algorithms are internal to the module; the binary (de)serialization below is the public interface used by the pipeline and downstream tooling.

s2gos_generator.processors.vegetation.save_vegetation_collection_binary

save_vegetation_collection_binary(
    vegetation_instances: List[Dict[str, Any]], output_path
) -> Dict[str, Any]

Save vegetation collection as compact NumPy structured array.

Parameters:

Name Type Description Default
vegetation_instances List[Dict[str, Any]]

List of vegetation dictionaries with position, rotation, scale

required
output_path

Path where to save the binary data

required

Returns:

Type Description
Dict[str, Any]

Dictionary with metadata about the saved vegetation collection

s2gos_generator.processors.vegetation.load_vegetation_collection_binary

load_vegetation_collection_binary(
    binary_path,
) -> np.ndarray

Load vegetation collection from binary format as numpy array.

Parameters:

Name Type Description Default
binary_path

Path to the binary vegetation file (.npy)

required

Returns:

Type Description
ndarray

Numpy structured array with vegetation data (x, y, z, rotation, scale, tilt_x, tilt_y)

ndarray

Returns empty array if loading fails

s2gos_generator.processors.vegetation.get_vegetation_collection_metadata

get_vegetation_collection_metadata(
    binary_path,
) -> Dict[str, Any]

Get metadata about a binary vegetation collection without loading all data.

Parameters:

Name Type Description Default
binary_path

Path to the binary vegetation data file

required

Returns:

Type Description
Dict[str, Any]

Dictionary with count, bounds, and other metadata