Plans.update - Waypoints

The below example shows how to update the waypoints and respond to any changes the user makes the above map. For example if the user moves the flight geometry, DroneDeploy recalculates the entire plan and then notifies apps who then have the ability to override fields. Therfore, you can't set the waypoints once, you have to reset the waypoints after every user change.

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <!-- This is a helper file we created. It provides the registerWaypointCalculationFunction.-->
  <script type="text/javascript" src=""></script>

<div>Waypoint Updates Count: <span id="count">0</span></div>

function isEven(num){
  return num % 2 === 0;

// This function needs to return a promise
function waypointCalculationFunction(currentPlan){
  return new Promise((resolve) => {
    const newWaypoints =, index) => {
      const alt = 50 + (index * 3) + (isEven(index) ? -10 : 10);
      return {alt, lat:, lng: waypoint.lng}

// Waypoints need to be recalculated everytime the user changes 
// the geometry or other fields on the plan
// this is a helper function to assist in setting the waypoints on 
// a plan
    document.querySelector('#count').innerHTML = parseInt(document.querySelector('#count').innerHTML) + 1;
  }, function(e){
    console.log('Error:', e);


Last updated