zensvi.metadata.MLYMetadata

class zensvi.metadata.MLYMetadata(path_input: str | pathlib.Path, log_path: str | pathlib.Path | None = None)

Bases: zensvi.metadata.base_metadata.BaseMetadata

Compute metadata for a Mapillary (MLY) dataset.

The input CSV (e.g. mly_pids.csv) already uses the schema expected by BaseMetadata"id", "lat", "lon", "captured_at", "compass_angle", "creator_id", "sequence_id", "organization_id", "is_pano" — so no column normalization is needed.

Parameters:
  • path_input (Union[str, Path]) – path to the input CSV file (e.g. mly_pids.csv).

  • log_path (Union[str, Path], optional) – Path to the log file. Defaults to None.

compute_metadata(unit: str = 'image', grid_resolution: int = 7, coverage_buffer: int = 50, indicator_list: str = 'all', path_output: str | pathlib.Path | None = None, max_distance: int = 50) pandas.DataFrame

Compute metadata for the dataset.

Parameters:
  • unit (str) – The unit of analysis. Defaults to “image”.

  • grid_resolution (int) – The resolution of the H3 grid. Defaults to 7.

  • indicator_list (str) – List of indicators to compute metadata for. Use space- separated string of indicators or “all”. Options for image-level metadata: “year”, “month”, “day”, “hour”, “day_of_week”, “relative_angle”, “h3_id”, “speed_kmh”. Options for grid-level metadata: “coverage”, “count”, “days_elapsed”, “most_recent_date”, “oldest_date”, “number_of_years”, “number_of_months”, “number_of_days”, “number_of_hours”, “number_of_days_of_week”, “number_of_daytime”, “number_of_nighttime”, “number_of_spring”, “number_of_summer”, “number_of_autumn”, “number_of_winter”, “average_compass_angle”, “average_relative_angle”, “average_is_pano”, “number_of_users”, “number_of_sequences”, “number_of_organizations”, “average_speed_kmh”. Defaults to “all”.

  • path_output (Union[str, Path]) – Path to save the output metadata. Defaults to None.

  • max_distance (int) – The maximum distance to search for the nearest street segment. Defaults to 50.

Returns:

A DataFrame containing the computed metadata.

Return type:

pd.DataFrame