Skip to content

Geofence + no-fly auto-sync

Geofence and no-fly polygons drawn in ARGUS don’t just render on the map — they’re synced natively to every DJI dock assigned to the mission, so the aircraft’s own flight controller enforces them. This is the third layer of ARGUS’s geofence safety envelope — it runs even if the ARGUS app, Android gateway, and the internet all disappear.

Polygon types that sync

Only two polygon types sync to DJI:

  • Geofence (type geofence) — keep-inside. Becomes a DJI dnfz (Do Not Fly Zone — inverse, aircraft must stay inside).
  • No-fly (type nofly) — keep-out. Becomes a DJI gfz (Geo-Fence Zone — forbidden area).

SAR polygons and search-grid polygons don’t sync — they’re planning-only.

Both polygons + circles are supported in the DJI custom-flight-area format.

The auto-sync pipeline

When you draw, edit, or delete a geofence / no-fly polygon on the map:

  1. 1.5-second debounce — polygon-draft events burst (each vertex- click fires a write). The debounce waits for edits to settle so drawing a 20-vertex polygon triggers one sync, not twenty.
  2. Fingerprint — ARGUS computes an MD5 of the polygon set. If the fingerprint matches the last-synced state, no sync happens. This dedups passes where polygons moved a pixel or two without actual change.
  3. Package — ARGUS serialises all current geofences + no-flys into the DJI custom-flight-area JSON format. MD5 is computed client-side (crypto.subtle doesn’t cover MD5 so there’s a fallback impl).
  4. Upload to S3 via a short-lived presigned PUT.
  5. Register with argus-api. argus-api validates the S3 object with HeadObjectCommand and writes a flight_areas/{id} doc.
  6. Assign the file to every dock currently scoped to the mission (dji_docks/{sn}.missionId == operationId). Writes a back-link assignedDocks on the flight-area doc so you can see which docks carry this zone.
  7. Publish MQTT flight_areas_update to each dock. argus-dji sends this service command.
  8. Dock downloads + applies. The aircraft’s flight controller now enforces the areas. From this point on, the drone physically can’t cross a boundary.

Empty-set behaviour

If you delete all your geofence + no-fly polygons, the sync still runs with a zero-length area file. The dock receives it and clears its local overrides — so deleting a polygon in ARGUS removes the restriction from the drone too.

Overlap + priority

If a geofence and no-fly overlap, the no-fly wins inside the overlap region. DJI’s flight controller treats no-fly as a hard-stop regardless of containing geofence.

Visualising sync state

Hover any polygon on the map → the info popover shows:

  • Whether the polygon has been synced to each dock.
  • Timestamp of the last successful sync per dock.
  • Fingerprint of the version the dock currently carries (useful for debugging: if dock A has fingerprint X and dock B has Y, you know one is stale).

The CRUD REST surface

Behind the scenes, argus-api provides the full CRUD REST for flight_areas:

  • POST /api/dji/flight-areas/upload-url — presigned PUT.
  • POST /api/dji/flight-areas/register — post-upload validation.
  • GET /api/dji/flight-areas — list by org, ordered by createdAt.
  • GET /api/dji/flight-areas/{id} — detail.
  • DELETE /api/dji/flight-areas/{id} — soft-delete (state='deleted').
  • POST /api/dji/docks/{sn}/flight-areas/assign — explicit assignment (separate from polygon-sync-driven auto-assignment).

Troubleshooting

  • Dock shows sync-failed. Check Admin → DJI management → Flight Areas for the per-dock assignment status. Most common cause: dock offline at sync time. Re-save any polygon to re-trigger sync; sync will apply once dock reconnects.
  • Dock ignores the polygon. Check firmware version. DJI’s custom- flight-area enforcement requires a minimum firmware level; older firmware accepts the file but doesn’t apply it. Upgrade via firmware.
  • Performance with very complex polygons. Thousand-vertex polygons strain the dock’s flight controller. Simplify via the polygon context menu’s Simplify action (RDP algorithm), or split into multiple simpler polygons.