A plan contains the flight data, drone data, image information, and the map assets. The same plan is used across planning, flight, uploading, and post-processed viewing.
Returns the plan that is currently visible to the user. For example, if the user is on the Explore or Fly page, the returned plan will be the plan they are viewing.
Example Call
// Get the current one timedronedeployApi.Plans.getCurrentlyViewed().then(function(plan){console.log(plan); });// Will be called each time the plan changesdronedeployApi.Plans.getCurrentlyViewed().subscribe(function(plan){console.log(plan); });
Get an array of all the users plans in memory. We store the 50 most recent and any plan a user loads in memory. Optionally, there is the ability to get the plans paginated.
Example Call
// Get all the users plan one timedronedeployApi.Plans.all().then(function(plans){console.log(plans); });// Will be called each time a plan changesdronedeployApi.Plans.all().subscribe(function(plans){console.log(plans); });// Paginatedvar paginated:boolean;var page:number;var status:string;dronedeployApi.Plans.all(paginated, page, status).then(function(plans){console.log(plans); });
Plans.update allows you to update specific fields within the flight plan model.
Please reference the fieldsToUpdate variable in the following code for the fields updatable by this api method.
constplanIdToUpdate= String;constfieldsToUpdate= {// These are the fields that can be updated on the plan name: String, altitude: Number,// in meters geometry: [{lat: Number, lng: Number},....], frontlap: Number, sidelap: Number, geometry: {lat: number, lng: number}, frontlap: Number,// allowed range: 15 - 95% sidelap: Number,// allowed range: 15 - 95% camera: { id: Number, capture_delay: Number, focal: Number, h_proj: Number, min_capture_period: Number, name: String, sensor_height: Number, sensor_width: Number, v_proj: Number, xres: Number, yres: Number, }, waypoints: [ { alt: Number // the altitude of the waypoint - in meters lat: Number // the latitude of the waypoint - floating point lng: Number //the longitude of the waypoint - floating point } ]};dronedeployApi.Plans.update(planIdToUpdate, fieldsToUpdate);
Note: Save the plan's geometry on the planning page to automatically re-calculate the drone's flight path.
Note: Save the plan's waypoints on the planning page to change the drones flight path manually. If you decide your app needs to alter waypoints, this is considered a privileged action and the user will be asked if they wish to allow it on a per plan basis.
Warning: Waypoint changes may be overwritten my manual updates by the user to their flight geometry via the interactive map. Any waypoint changes should be in direct response to a Plans.getCurrentlyViewed, and either ignore, or handle changes to geometry, based on what your app is trying to achieve. Please see this example for an example.
Warning: Changing geometry will overwrite any changes to waypoints, by recalculating the optimal flight path as per DD's calculation code. Please see this example for an example.
Plans.create allows you to create a new plan with an array of coordinates and an options object.
Example Call
var geometry = [ {lat:35.92778956007768, lng:-96.74685001373292}, {lat:35.92524492896255, lng:-96.74667120678352}, {lat:35.92532220011748, lng:-96.74959659576417}, {lat:35.92778151526379, lng:-96.7496186761855},];var options = { name:'Example Plan', geometry: geometry };// Returns the id of the newly created plandronedeploy.Plans.create(options).then(function(planId) {console.log(planId); });