Drone Chainage & SRT Processing

A Streamlit application that automates extraction and processing of GPS metadata from DJI drone video .srt files, generates chainage markers along a reference alignment (KML), and produces synchronized SRT outputs and 3D visualizations.


🚀 Purpose

  • Extract latitude, longitude, altitude, and timestamp data embedded in DJI .srt files.
  • Chainage: compute distances along a surveyed alignment (a 2D KML LineString) and insert regular markers (every 50 m).
  • Project drone track start/end onto the chainage alignment to find matching station values.
  • Visualize the drone path and alignment in an interactive 3D view.
  • Export:
    • 3D KMLs of the drone route with START/END placemarks.
    • Six separate SRT files (Latitude, Longitude, Altitude, Timer, LatLon, Chainage).
    • Bulk‐processing support for multiple .srt files in one go.

📋 Features & Workflow

  1. Upload Inputs
    • DJI .srt (with [latitude: …][longitude: …][altitude: …]).
    • Full‐chainage .kml (2D LineString of reference alignment).
  2. Generate 50 m Markers
    • Interpolate along the KML every 0.05 km.
    • Download markers_50m.kml for inspection.
  3. Confirm Markers Direction
    • If backward, reverse the alignment and regenerate markers.
  4. Project SRT Start/End
    • Parse the initial .srt into GPS track points.
    • Compute total route length.
    • Find nearest chainage-station for the first/last points.
  5. Confirm SRT Direction
    • Reverse the track if start/end mapping is inverted.
  6. Visualize in 3D
    • Chainage line (gray) at altitude = 0.
    • Drone track (red) in true altitude.
    • START (green) and END (blue) markers with station labels.
  7. Export Initial SRT-Derived Files
    • Download initial_srt_route.kml with START/END.
    • Download a ZIP of six SRT files prefixed initial_01_…initial_06_….
  8. Bulk Processing (optional)
    • Upload multiple additional .srt files.
    • Skip Steps 2–6 and generate 3D KML + SRT ZIP for each.
  9. Bundle & Download
    • All KMLs and SRTs are packaged into a final all_outputs.zip for one-click retrieval.


🔍 Under the Hood: Mathematical Background

1. Haversine Formula

Computes great‐circle distance between two GPS points (φ1,λ1) and (φ2,λ2):

Δφ=φ2−φ1,Δλ=λ2−λ1,a=sin2⁡(Δφ/2)+cos⁡φ1,cos⁡φ2,sin2⁡(Δλ/2),d=2Rarcsin⁡(a),

where:

  • φ = latitude (radians), λ = longitude (radians)
  • R ≈ 6371 km (Earth’s radius)
  • d = distance along Earth’s surface.

2. Cumulative Chainage

Given points P0,P1,…,Pn:

Ck=∑i=1kd(Pi−1,Pi),

where d() is the segment length from Haversine.

3. Regular Interval Markers

To place markers every Δ km:

  1. Build cumulative array [C0=0,C1,…,Cn].
  2. For each$ D=0, Δ, 2Δ,…,C_n$: find segment i with Ci−1<D≤Ci, compute fraction f=(D−Ci−1)/(Ci−Ci−1), and interpolated point P(D)=(1−f)Pi−1+fPi.