environmentaltools.drone.create

environmentaltools.drone.create(template_kmz_folder: Path, csv_path: Path, chunk_size: int = 50, take: str = 'first', out_dir: Path | None = None, polygon_no: str = '001')[source]

Generate multiple KMZ mission files by splitting waypoints CSV into chunks.

This function processes a large waypoints CSV file by dividing it into smaller chunks and creating individual KMZ mission files for each chunk. It also generates preview images showing the mission area and waypoints.

Parameters:
  • template_kmz_folder (Path) – Path to the template KMZ folder used as a base for new missions.

  • csv_path (Path) – Path to the input CSV file containing waypoint data.

  • chunk_size (int, optional) – Maximum number of waypoints per generated KMZ file. Default is 50.

  • take (str, optional) – Strategy for selecting waypoints (“first”, “last”, etc.). Default is “first”.

  • out_dir (Path, optional) – Base output directory for generated files. If None, uses “missions” directory.

  • polygon_no (str, optional) – Polygon identifier used in output directory structure. Default is “001”.

Returns:

Creates KMZ files and preview images in the output directory structure: out_dir/polygon_no/NNN/NNN.kmz and map_preview/NNN/NNN.jpg

Return type:

None

Raises:
  • SystemExit – If template folder doesn’t exist, CSV file not found, or CSV is empty.

  • FileNotFoundError – If the KMZ builder utility script is not found.

Notes

The function creates a directory structure like: - missions/polygon_no/001/001.kmz - missions/polygon_no/002/002.kmz - missions/polygon_no/map_preview/001/001.jpg - missions/polygon_no/map_preview/002/002.jpg

Each KMZ file contains a subset of waypoints from the original CSV, with waypoint indexing restarting from 0 for each chunk.