Best Practices
SafeSky UAV API - Integration Guide
This pageguide provides developer-orientedarchitectural patterns and best practices for integrating the SafeSky UAV API into custom mission control software, moving-map applications, orand operational dashboards.
Overview
The objectiveSafeSky isAPI enables developers to build aproduction-grade smooth,air scalable,traffic awareness systems that display real-time positions of UAVs, helicopters, general aviation aircraft, and operationallycommercial correcttraffic. This guide addresses the technical challenges of building responsive, scalable traffic layerlayers showingthat crewedmeet aircraft,operational helicopters,aviation and UAV activity in real time.standards.
AReference live reference implementation using these principles is available at:Implementation: https://live.safesky.app
Key Design Goals
- Real-time traffic awareness with minimal latency
- Smooth, professional rendering on dynamic maps
- Efficient resource utilization for fleet operations
- Compliance with aviation best practices
1. Recommended Integration Architecture
Dual-Thread Pattern
AImplement robusttraffic integrationretrieval shouldand maintaintelemetry publishing as twoindependent, independentasynchronous executionprocesses. threads:This separation is critical for operational reliability.
1.┌─────────────────────┐ ┌─────────────────────┐
│ Traffic Retrieval │ │ Telemetry Publisher │
│ Thread
┌─────────────────────┐ ┌─────────────────────┐
│ Traffic Retrieval │ │ Telemetry Publisher │
│ Thread- │
Responsible│forThreadfetching│nearby├─────────────────────┤air├─────────────────────┤traffic│ UsesGET /v1/uavUpdates│the│map continuously
2. UAV Publishing Thread
Responsible for publishing your UAV telemetryUsesPOST /v1/uav │ │ Viewport queries │ │ Position updates │ │ 1Hz polling │ │ 1Hz transmission │ └─────────────────────┘ └─────────────────────┘ ↓ ↓ ┌────────────────────────────────────┐ │ Application State/Map │ └────────────────────────────────────┘Architectural Benefits:
- Fault isolation: Network issues in one thread don't cascade to the other
RunsIndependentindependentlyscaling:ofAdjusttrafficpollingretrievaland publishing rates separately- Simplified error handling: Each thread manages its own retry logic
- Resource optimization: Non-blocking I/O prevents thread starvation
SeparatingImplementationtheseNote:concernsInimprovessingle-threadedreliability,environmentsscalability,(e.g.,andJavaScript),errorusehandling.separate async tasks or workers to achieve the same isolation.
2.
RetrievingTrafficforRetrievalaStrategyMoving MapUseViewport-Based Queries
For map-based applications,
always preferuseviewport-basedbounding box queriesinsteadthatofalignradius-basedwithsearches.the visible viewport:GET /v1/uav?viewport=lat_min,lng_min,lat_max,lng_maxWhyExample:
GET /v1/uav?viewport=48.8566,2.3522,48.8766,2.3922Technical Advantages:
Aspect Viewport Query Radius Query Zoom adaptability Natural scaling with map bounds Fixed circular area Data efficiency Fetches only visible region Often includes off-screen data Rendering alignment 1:1 with visible area Requires post-filtering Edge cases Handles rectangular screens correctly Circular overlap issues Performance Impact: At high zoom levels (city view), viewport queries
arecanpreferredreduce- payload
Matchessizemapbyrendering40-60%logiccompared Scalestoefficientlyradius-basedatapproachesallthatzoomcoverlevelsthe Avoidssameunnecessaryvisibleoff-screen trafficEnables smooth pan & zoom interactions
Overscan)AddViewport
a Safety MarginPadding (Outset)AlwaysExtendextendquerytheboundsviewport slightly5-15% beyond the visible viewport to improve UX and anticipate edge transitions.Implementation Example:
const OVERSCAN_FACTOR = 0.10; // 10% padding function getQueryViewport(mapBounds) { const latPadding = (mapBounds.north - mapBounds.south) * OVERSCAN_FACTOR; const lngPadding = (mapBounds.east - mapBounds.west) * OVERSCAN_FACTOR; return { lat_min: mapBounds.south - latPadding, lng_min: mapBounds.west - lngPadding, lat_max: mapBounds.north + latPadding, lng_max: mapBounds.east + lngPadding }; }Benefits:
- Eliminates visual "pop-in" during map
bounds.panning - Pre-loads aircraft approaching screen edges
- Smooths fast-moving traffic transitions (e.g., aircraft at 200+ knots)
- Minimal bandwidth overhead (typically <10% additional data)
Tuning Guidance: Use larger padding (12-15%) for high-speed traffic environments or slower network connections.
Polling Frequency
Recommended
margin:interval: 1 second (1Hz)+5% to +15% on each side of the viewportThis
ensures:frequency balances real-time awareness with reasonable bandwidth consumption.Rationale:
- Aircraft
nearmovingscreenatedges100areknotsstilltravelfetched~50 meters per second No1-secondvisualupdates“pop-in”providewhensmoothpanninginterpolation without perceptible lagBetterAlignsanticipationwithofaviation-gradefast-movingsituationaltrafficawareness requirements- Acceptable load for both mobile and web clients
FetchingNetworkslightly more traffic than visible is intentional and recommended.Optimization:Polling FrequencyRecommendedImplementGETexponentialinterval:backoff1forsecondfailed requestsProvidesConsidersmoothcompressionmotion(gzip/brotli)andfornear-real-time awarenessresponsesSuitableUse HTTP/2 or HTTP/3 where available forbothconnectionUAV and crewed aircraft trafficmultiplexing
3.
PublishingUAV TelemetryUsePublishingthe following endpoint to publish one or more UAVs:Endpoint
POST /v1/uav Content-Type: application/jsonPublishing
FrequencyRecommended POST interval:Frequency: 1 second
Fleet OperationsBatch Publishing
(StronglyforRecommended)IfWhen managing multipleUAVsUAVs,simultaneously,alwayspublishuse batch publishing by sending an array of telemetry objects inbatchusinga singlePOSTrequest.WhyPerformancebatchComparison:publishingmatters:Approach UAVs Requests/sec HTTP Overhead Network Latency Individual 10 10 ~4KB 10× RTT Batch 10 1 ~400B 1× RTT Key Benefits:
- Reduced overhead: Single HTTP
overheadhandshake vs. multiple connections LowerAtomiclatencytimestamps: All UAVs share consistent update timeConsistentLowertimestampslatency:acrossOneUAVsround-trip instead of N round-tripsBetterImprovedscalabilityscalability: Essential forfleetsswarmandoperationsswarms(20+ UAVs)
RecommendedBestapproach:Practice:- Aggregate
all UAVtelemetryupdatesinperyourcycleapplication Sendloopthemandtogetherpublishoncetheperentiresecondfleet Avoidstateindividual POSTs per UAV
Example: Batch UAV Publish Payload
[ { "id": "UAV1", "latitude": 48.86584, "longitude": 2.63723, "altitude": 120, "course": 205, "ground_speed": 12, "status": "AIRBORNE", "last_update": 1733412793 }, { "id": "UAV2", "latitude": 48.87012, "longitude": 2.64188, "altitude": 115, "course": 210, "ground_speed": 10, "status": "AIRBORNE", "last_update": 1733412793 } ]
Status4. Pre-Flight Visibility
(GroundedGROUNDED
Status)
BroadcastingAdvertise Before Takeoff
positionBefore takeoff, it is consideredbest practiceto publish thePublish UAVwith:with
statusstatus:= GROUNDED"GROUNDED"When:Ideally3–3-5 minutes before takeoff.{ "id": "UAV1", "latitude": 48.86584, "longitude": 2.63723, "altitude": 0, "status": "GROUNDED", "last_update": 1734537600 }Operational Rationale:
- Provides advanced notification to nearby crewed aircraft and helicopters
- Establishes situational awareness before airspace usage
- Aligns with aviation practice of pre-flight intent signaling
- Particularly important near helipads, airports, or low-altitude flight zones
Why:State Transition:Makes UAV activity visible to helicopters and crewed aircraftImproves shared situational awarenessMirrors aviation intent signaling
SwitchTransition toimmediatelyAIRBORNEstatus: "AIRBORNE"afterupontakeoff.takeoff to reflect actual flight status.Implementation Note: For mission planning applications, this can be automated based on pre-filed flight plans or launch schedules.
Position Extrapolation5. Smooth
AircraftMotion(RenderingClient-Side
Extrapolation)Traffic updates arrive at discrete 1-second intervals. To
animation,avoidachieve“jumping”smoothicons:Useimplementextrapolationdead reckoning betweenupdatesPredict position using:Last known positionGround speedCourse
Linearly extrapolate until the next update arrives
ThisAlgorithm:creates:function extrapolatePosition(aircraft, currentTime) { const elapsedSeconds = (currentTime - aircraft.last_update) / 1000; const distanceMeters = aircraft.ground_speed * 0.514444 * elapsedSeconds; // knots to m/s const deltaLat = distanceMeters * Math.cos(aircraft.course * Math.PI / 180) / 111320; const deltaLng = distanceMeters * Math.sin(aircraft.course * Math.PI / 180) / (111320 * Math.cos(aircraft.latitude * Math.PI / 180)); return { latitude: aircraft.latitude + deltaLat, longitude: aircraft.longitude + deltaLng }; }Rendering Impact:
Smooth,Transformsprofessionaldiscrete position updates into fluid 60fps animation- Eliminates visual "jumping" or "teleporting" artifacts
- Creates professional, aviation-grade map
renderingpresentation BetterImproves user perception of traffic flowReduced visual jitterpatterns
Limitation: Extrapolation assumes constant velocity and heading. Maneuvering aircraft may show brief position discrepancies until the next update.
6. Traffic
Ageing,AgingUncertainty &and ExpiryData Freshness Management
Different traffic
typessources have differentlifetimes.validity windows based on their update characteristics.Advisory UAV Traffic
ValidValidity:upUp to 2 minutes aftertimestamplastexpiryupdateShouldRationale:remainLowervisiblespeedwithandappropriatepredictable flight patterns- Display: Apply visual
indicationindicators for aged data (reduced opacity, uncertainty ring)
L)OtherReal-Time Air Traffic (ADS-B, FLARM, ADS-
L, etc.)Time since last updateAgeRecommendedStatebehaviorVisualization 0–30 seconds0-30sDisplayCurrentnormallyFull opacity, normal icon 30–45 seconds30-45sDisplayStalewithReduced opacity + expanding uncertainty circle > 4545ssecondsExpired Remove from display Uncertainty Visualization
ShowApproach:
Implementation
anfunctionexpandinggetUncertaintyRadius(lastUpdate, currentTime, groundSpeed) { const ageSeconds = (currentTime - lastUpdate) / 1000; if (ageSeconds < 30) return 0; // Assume maximum maneuvering potential const maxDistanceMeters = groundSpeed * 0.514444 * ageSeconds; return maxDistanceMeters; // Display as circlearoundradiuslast}knownpositionRadius increases over time to reflect possible movement- Prevents false precision
afterinsignalpositionlossestimates.
Purpose:
Visual Design: Use semi-transparent expanding circles that grow linearly with time since last update.
7. Visual
RepresentationDesignBestGuidelinesPracticesTraffic Icon States
RecommendedImplement progressive visualcues:feedback to communicate data confidence:Data Freshness States: ┌─────────────┬──────────────┬────────────────┬──────────────┐ │ Current │ Aging │ Uncertain │ Expired │ │ (0-30s) │ (30-45s) │ │ (>45s) │ ├─────────────┼──────────────┼────────────────┼──────────────┤ │ Solid icon │ 70% opacity │ + uncertainty │ Remove from │ │ Full color │ Subtle pulse │ circle │ display │ └─────────────┴──────────────┴────────────────┴──────────────┘Traffic Categorization
Use distinct iconography for different aircraft types:
SolidUAV/Drone:icon:Quadcopterfreshordatafixed-wing silhouetteReducedHelicopter:opacity:Rotor-basedagingicondatawith rotation indicatorExpandingGeneraluncertaintyAviation:circle:SmallsignalaircraftdegradationsilhouetteDistinctCommercial:iconsLargerperaircrafttrafficprofile- Unknown:
(UAV,Generichelicopter,aircraftGA, jet)symbol
categoryAccessibility Note: Ensure icons are distinguishable by shape, not just color, for colorblind users.
Assets8. Icon
SetsTo simplify integration,SafeSky providesready-to-use trafficoptimized icon setsoptimisedformaprapidrendering.integration.📦Download:Icon sets download (placeholder):https://docs.safesky.app/downloads/iconsetsIncludes:Package Contents:- Formats: SVG (vector) and PNG
formats(raster) MultipleSizes:sizes24×24, 32×32, 48×48, 64×64 pxDarkThemes: Light and dark mode variants- Categories: UAV, helicopter, GA, commercial, glider, balloon
Usage Recommendations:
- Use SVG for web applications (resolution independence, smaller payload)
- Use PNG for native applications with fixed DPI requirements
- Implement theme switching based on map style (dark maps = light
themesicons)
Parameters9.
RecommendedConfiguration ReferenceTiming
SummaryActionParameterIntervalValueRationale GET traffic (viewport) 1 second Optimal balance of real-time awareness and bandwidth POST UAV telemetry 1 second Maintains continuity for receiving applications Pre-flight GROUNDED publish 3–5 minutesmin before takeoffProvides advanced notice to nearby traffic StartUncertaintyuncertaintyvisualization30 seconds after update Reflects realistic position drift DiscardTraffictrafficexpiry (non-UAV)45 seconds after update Prevents stale data display UAV expiry 2 minutes after update Accommodates lower-frequency updates Viewport overscan 10-15% Eliminates edge transition artifacts
10. Reference Implementation
AExploreliveaexampleproductionimplementingimplementationallof thesebest practices is available at:patterns:Live Demo: https://live.safesky.app
The reference implementation demonstrates:
- Dual-thread architecture with independent polling and publishing
- Viewport-based queries with dynamic overscan
- Client-side position extrapolation for smooth rendering
- Progressive data aging with uncertainty visualization
- Batch telemetry publishing for fleet operations
Use the browser developer tools to observe network traffic patterns, polling behavior, and rendering optimizations in a production environment.
Additional Resources
- API Reference: Full endpoint documentation and schemas
- Authentication Guide: HMAC signing and API key management
- Rate Limits: Request throttling and quota information
- Support: Technical support channels and community forums