Skip to main content

DjiKMZ - DJI Task Plan KMZ File Generator

⚠️ DEVELOPMENT STATUS NOTICE

This project is currently in active development and testing phase. Due to time and resource constraints, real-world flight testing has only covered partial functionality and drone models. (Mostly M350)

Please use with caution in production environments. We strongly recommend thorough testing/validation on controller before field deployment.

🤝 Contributions and bug reports are welcome! Help us improve the library by:

  • Testing with different drone models
  • Reporting issues and edge cases
  • Contributing code improvements
  • Sharing real-world usage experiences

A Python package for generating DJI task plan KMZ files with comprehensive type safety, validation, and integrity checks.

Goal

  • 🛡️ Type Safety: Full type hints and Pydantic models for all data structures
  • ✅ Validation: Comprehensive validation of waypoints, coordinates, and flight parameters
  • 🔒 Integrity Checks: Built-in validation for DJI-specific constraints and limits
  • 📦 KMZ Generation: Generate valid KMZ files compatible with DJI flight planning software
  • 🎯 Abstraction: High-level API for easy waypoint and mission creation

Installation

pip install djikmz

Quick Start

from djikmz import DroneTask

# Create a mission
mission = (DroneTask("M350", "Survey Pilot")
    .name("Basic Survey") 
    .payload("P1")
    .speed(8.0)
    .altitude(75.0)
    .fly_to(37.7749, -122.4194)
        .take_photo("point0")
        .hover(2.0)
    .fly_to(37.7750, -122.4195)
        .take_photo("point1"))

# Generate KMZ
mission.to_kmz("mission.kmz")

Supported Drone Models

  • M350 (Matrice 350 RTK)
  • M300 (Matrice 300 RTK)
  • M30/M30T (Matrice 30 Series)
  • M3E/M3T/M3M (Mavic 3 Enterprise Series)
  • M3D/M3TD (Mavic 3 Classic Series)
  • Other drones may be added in future releases.

API Reference

Task Builder API

from djikmz import DroneTask

# TaskBuilder API - Primary interface
mission = DroneTask(drone_model, pilot_name)
    .payload(payload_model)  # Optional payload model
    .name(mission_name)
    .speed(m_per_sec)
    .altitude(meters)

# Flight commands  
    .fly_to(lat, lon, height=None)  # Optional height for altitude

# waypoint settings
    .height(meters)  
    .speed(m_per_sec)
    .turn_mode("turn_at_point"|"early_turn"|"curve_and_stop"|"curve_and_pass")

# Camera actions
    .take_photo(label)
    .start_recording()
    .stop_recording()

# Hover
    .hover(seconds)

# Aircraft Heading
    .heading(angle) 

# Gimbal control (absolute positioning)
    .gimbal_down(45)        # Point down to 45° from forward
    .gimbal_up(30)          # Point up to 30° from forward  
    .gimbal_front()         # Point straight forward (0°)
    .gimbal_pitch(-90)      # Precise pitch: -90° (straight down)
    .gimbal_yaw(180)        # Precise yaw: 180° (facing south)
    .gimbal_rotate(pitch=-45, yaw=90)  # Combined rotation

# Save to a ready to use Dji KMZ file
mission.to_kmz(file_path) 

# Or generate KML for further processing
mission.build() -> KML

Advanced Model Access

from djikmz.model import KML, Waypoint, DroneModel
from djikmz.model.action import TakePhotoAction, HoverAction

# For direct model manipulation and custom integrations
waypoint = Waypoint(lat=37.7749, lon=-122.4194)
action = TakePhotoAction(action_id=1)

Validation

DjiKMZ provides comprehensive validation:

  • Coordinates: Latitude [-90,90], Longitude [-180,180]
  • Drone Limits: Speed, altitude, and capability validation
  • DJI Standards: Action IDs, waypoint limits, XML structure

TODOs

  • Load existing KMZ files and parse waypoints
  • Task modifications

Development

# Clone the repository
git clone https://github.com/yourusername/djikmz.git
cd djikmz

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

Metadata

Release files for djikmz 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djikmz 0.1.0
File Size Uploaded
djikmz-0.1.0.tar.gz 58.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djikmz 0.1.0
File Interpreter ABI Platform
djikmz-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 94.3 kB

Release files / djikmz-0.1.0.tar.gz

Download URL djikmz-0.1.0.tar.gz
Size 58.0 kB
Tags Source
SHA-256 checksum
How to use checksums
765693b89ccc000081c6dc76b489d3a8853050bcac20e8f54b646b58fb266424
BLAKE2b-256 checksum
How to use checksums
7d148841aa02ae43fa67c7ed75d99ac1ff1fe71a8fe5dc4b52586c0f7d25da89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Release files / djikmz-0.1.0-py3-none-any.whl

Download URL djikmz-0.1.0-py3-none-any.whl
Size 36.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c9e180cc36d7b2671372b461a1ba568d85be19a859fc05a62afe7ea10a44979
BLAKE2b-256 checksum
How to use checksums
489429cde6be31f2c3b7ef586a98bca1f7b81d0d785f64e129405747f9bbf99f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page