{"id":18666968,"url":"https://github.com/hotosm/drone-flightplan","last_synced_at":"2025-04-11T23:33:29.622Z","repository":{"id":249615617,"uuid":"832007138","full_name":"hotosm/drone-flightplan","owner":"hotosm","description":"Drone Flight Plan generator","archived":false,"fork":false,"pushed_at":"2025-02-27T04:55:12.000Z","size":184,"stargazers_count":13,"open_issues_count":6,"forks_count":3,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-06T02:15:20.798Z","etag":null,"topics":["drones","flightplan","waypoints"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/drone-flightplan/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hotosm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-22T07:03:09.000Z","updated_at":"2025-02-27T04:55:07.000Z","dependencies_parsed_at":"2024-09-17T10:48:36.316Z","dependency_job_id":"0c9154cc-4800-4424-b2b8-291cb7aeb2e0","html_url":"https://github.com/hotosm/drone-flightplan","commit_stats":null,"previous_names":["hotosm/drone-flightplan"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotosm%2Fdrone-flightplan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotosm%2Fdrone-flightplan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotosm%2Fdrone-flightplan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotosm%2Fdrone-flightplan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hotosm","download_url":"https://codeload.github.com/hotosm/drone-flightplan/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248496014,"owners_count":21113751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drones","flightplan","waypoints"],"created_at":"2024-11-07T08:35:09.132Z","updated_at":"2025-04-11T23:33:29.613Z","avatar_url":"https://github.com/hotosm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drone Flightplan\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/hotosm/fmtm/main/docs/images/hot_logo.png\" style=\"width: 200px;\" alt=\"HOT\"\u003e\n\u003c/p\u003e\n\n\u003e [!WARNING]\n\u003e\n\u003e Archived.\n\u003e\n\u003e This repo was moved to be a package in a monorepo.\n\u003e\n\u003e https://github.com/hotosm/drone-tm/tree/development/src/backend/packages/drone-flightplan\n\u003e\n\u003e See: https://github.com/hotosm/drone-tm/pull/521\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eGenerates waypoints for drone and creates a flightplan\u003c/em\u003e\n\u003c/p\u003e\n\n---\n\n📖 **Documentation**: [https://hotosm.github.io/drone-flightplan/](https://hotosm.github.io/drone-flightplan/)\n\n🖥️ **Source Code**: [https://github.com/hotosm/drone-flightplan](https://github.com/hotosm/drone-flightplan)\n\n---\n\n## Overview\n\nThe Drone Flightplan Generator is a Python package designed to automate the creation of flight plans for drones. This tool is essential for users needing efficient and precise aerial surveys, mapping, and imagery collection.\n\n### Waypoint File\n\nDJI drones require waypoint files. WPML route files all end with a \".kmz\" suffix and are essentially archive files packed in ZIP format. After decompression of a standard WPML route file, its file structure is as follows:\n\n![image](https://github.com/user-attachments/assets/bb7a6f95-29f8-40e0-972c-92a974aa0bf0)\n\nFor more details, check the [DJI Cloud API documentation](https://github.com/dji-sdk/Cloud-API-Doc/blob/master/docs/en/60.api-reference/00.dji-wpml/10.overview.md).\n\n## Installation\n\nTo install the package, use pip:\n\n```bash\npip install drone-flightplan\n```\n\n## Modules\n\n### 1. `calculate_parameters`\n\nThis module helps in calculating various parameters required for the flight plan, such as:\n\n```\ncalculate_parameters(\n    forward_overlap: float,\n    side_overlap: float,\n    agl: float,\n    gsd: float = None,\n    image_interval: int = 2,\n)\n```\n\n**Parameters:**\n\n- `AGL` (Altitude above ground level in meters) = 115\n- `Forward overlap` = 75\n- `Side overlap` = 75\n\n**Fixed Parameters:**\n\n- `Image interval` = 2 sec\n- `Vertical FOV` = 0.71\n- `Horizontal FOV` = 1.26\n\n**Calculations:**\n\n- Forward Photo height = AGL *Vertical_FOV = 115* 0.71 = 81.65\n- Side Photo width = AGL *Horizontal_FOV = 115* 1.26 = 144\n- Forward overlap distance = Forward photo height *Forward overlap = 75 / 100* 81.65 = 61.5\n- Side overlap distance = Side photo width *Side overlap = 75 / 100* 144 = 108\n- Forward spacing = Forward photo height - Forward overlap distance = 81.65 - 61.5 = 20.15\n- Side spacing = Side photo width - Side overlap distance = 144 - 108 = 36\n- Ground speed = Forward spacing / Image interval = 10\n\n**Parameters:**\n\n- `waypoints_geojson`: The waypoint coordinates to be included in the flight plan mission.\n- `parameters`: The drone flight parameters in JSON format.\n\n### 2. `create_waypoint`\n\nThis module generates waypoints for a given project area, using parameters such as altitude, GSD, overlap ratios, and the option to avoid no-fly zones. It can also create 3D waypoints:\n\n```\nfrom drone_flightplan import create_waypoint\n\ncreate_waypoint(\n    project_area,\n    agl,\n    gsd,\n    forward_overlap,\n    side_overlap,\n    rotation_angle=0.0,\n    generate_each_points=False,\n    generate_3d=False,\n    no_fly_zones=None,\n    take_off_point=None,\n)\n```\n\n**Parameters:**\n\n- `project_area` (dict): A GeoJSON dictionary representing the project area (Polygon AOI).\n- `agl` (float): Altitude above ground level (the height at which the drone will fly).\n- `gsd` (float): Ground Sampling Distance (resolution of the images captured).\n- `forward_overlap` (float): Desired forward overlap percentage for the images in the flight plan.\n- `side_overlap` (float): Desired side overlap percentage for the images in the flight plan.\n- `rotation_angle` (float, optional): The rotation angle for the flight grid in degrees (default is 0.0).\n- `generate_each_points` (bool, optional): True to generate individual waypoints, False to generate waylines connecting waypoints for a continuous flight path.\n- `generate_3d` (bool, optional): True to capture 3D images at −90°, −45°, and 45° lateral angles, False to capture only 2D images.\n- `no_fly_zones` (dict, optional): A GeoJSON dictionary representing no-fly zones (areas to avoid).\n- `take_off_point` (list[float], optional): The GPS coordinates of the take-off point [longitude, latitude] for the flight.\n\n### 3. `add_elevation_from_dem`\n\nThis module integrates elevation data from Digital Elevation Models (DEMs) into the flight plan to account for changes in terrain. This ensures more accurate waypoint positioning for varying altitudes:\n\n```\nfrom drone_flightplan import add_elevation_from_dem\n\nadd_elevation_from_dem(raster_file, points, outfile)\n```\n\n**Parameters:**\n\n- `raster_file`: Path to the DEM GeoTIFF file.\n- `points`: GeoJSON string with point coordinates.\n- `outfile`: Path for saving the output with added elevation.\n\n### 4. `create_placemarks`\n\nThis module creates placemarks for the flight plan, useful for marking key locations:\n\n```\nfrom drone_flightplan import create_placemarks\n\ncreate_placemarks(\n    waypoints_geojson: Union[str, FeatureCollection, dict], \n    parameters: dict\n)\n```\n\n### 5. `create_wpml`\n\nThis module is responsible for creating WPML files (Waypoint Markup Language), which are often used for visualizing waypoints and flight paths in different tools or simulators:\n\n```\nfrom drone_flightplan import create_wpml\n\ncreate_wpml(\n    placemark_geojson: Union[str, FeatureCollection, dict],\n    output_file_path: str = \"/tmp/\",\n)\n```\n\n**Parameters:**\n\n- `placemark_geojson`: The placemark coordinates to be included in the flight plan mission.\n- `output_file_path`: The output file path for the WPML file.\n\n### 6. `create_flightplan`\n\nThis is the core function responsible for generating a complete flight plan for a specified area of interest (AOI):\n\n```\nfrom drone_flightplan import create_flightplan\n\ncreate_flightplan(\n    aoi,\n    forward_overlap,\n    side_overlap,\n    agl,\n    gsd=None,\n    image_interval=2,\n    dem=None,\n    outfile=None,\n    generate_each_points=False,\n    rotation_angle=0.0,\n    take_off_point=None,\n)\n```\n\n**Parameters:**\n\n- `aoi`: The area of interest in GeoJSON format.\n- `forward_overlap` (float): Desired forward overlap percentage for the images.\n- `side_overlap` (float): Desired side overlap percentage for the images.\n- `agl` (float): Altitude above ground level (in meters) for drone flight.\n- `gsd` (float, optional): Ground sampling distance in cm/px. If not provided, it will be calculated based on the altitude.\n- `image_interval` (int, optional): Time interval (in seconds) between two consecutive image captures.\n- `dem` (str, optional): Path to the Digital Elevation Model (DEM) file to add terrain elevation data to the flight plan.\n- `outfile` (str, optional): The output file path where the resulting flight plan will be saved. If not provided, the flight plan is returned as a string.\n- `generate_each_points` (bool, optional): True to generate individual waypoints for flight, False to generate waylines.\n- `rotation_angle` (float, optional): The rotation angle (in degrees) for the flight grid. Default is 0.0.\n- `take_off_point` (list[float], optional): A list of GPS coordinates [longitude, latitude] for the takeoff point.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotosm%2Fdrone-flightplan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhotosm%2Fdrone-flightplan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotosm%2Fdrone-flightplan/lists"}