Template.kml

2022-07-22
No Rating

template.kml Introduction

The template.kml file consists of three parts:

  1. Creation information: It mainly contains the information of the route file itself, such as the creation and update time of the file.
  2. Mission information: mainly includes the wpml:missionConfig element, which defines the global parameters of the route mission, etc.
  3. Template information: It mainly contains the Folder element, which defines the template information of the route (such as waypoint flight, map-building aerial photography, oblique photography, and flight with flight path, etc.). Different route template types contain different elements.

The example file of template.kml is as follows (take the waypoint flight template as an example):

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:wpml="http://www.dji.com/wpmz/1.0.0">
<Document>

  <!-- Step 1: Implement File Creation Information -->
  <wpml:author>Name</wpml:author>
  <wpml:createTime>1637600807044</wpml:createTime>
  <wpml:updateTime>1637600875837</wpml:updateTime>
 
  <!-- Step 2: Setup Mission Configuration -->
  <wpml:missionConfig>
    <wpml:flyToWaylineMode>safely</wpml:flyToWaylineMode>
    <wpml:finishAction>goHome</wpml:finishAction>
    <wpml:exitOnRCLost>goContinue</wpml:exitOnRCLost>
    <wpml:takeOffSecurityHeight>20</wpml:takeOffSecurityHeight>
    <wpml:globalTransitionalSpeed>10</wpml:globalTransitionalSpeed>
    <wpml:droneInfo>
      <!-- Declare drone model with M30 -->
      <wpml:droneEnumValue>67</wpml:droneEnumValue>
      <wpml:droneSubEnumValue>0</wpml:droneSubEnumValue>
    </wpml:droneInfo>
    <wpml:payloadInfo>
      <!-- Declare payload model with M30 -->
      <wpml:payloadEnumValue>52</wpml:payloadEnumValue>
      <wpml:payloadSubEnumValue>0</wpml:payloadSubEnumValue>
      <wpml:payloadPositionIndex>0</wpml:payloadPositionIndex>
    </wpml:payloadInfo>
  </wpml:missionConfig>
 
  <!-- Step 3: Setup A Folder for Waypoint Template -->
  <Folder>
    <wpml:templateType>waypoint</wpml:templateType>
    <wpml:useGlobalTransitionalSpeed>0</wpml:useGlobalTransitionalSpeed>
    <wpml:templateId>0</wpml:templateId>
    <wpml:waylineCoordinateSysParam>
      <wpml:coordinateMode>WGS84</wpml:coordinateMode>
      <wpml:heightMode>EGM96</wpml:heightMode>
      <wpml:ellipsoidHeight>100</wpml:ellipsoidHeight>
      <wpml:height>100</wpml:height>
      <wpml:positioningType>GPS</wpml:positioningType>
    </wpml:waylineCoordinateSysParam>
    <wpml:autoFlightSpeed>7</wpml:autoFlightSpeed>
    <wpml:transitionalSpeed>7</wpml:transitionalSpeed>
    <wpml:gimbalPitchMode>usePointSetting</wpml:gimbalPitchMode>
    <wpml:globalWaypointHeadingParam>
      <wpml:waypointHeadingMode>followWayline</wpml:waypointHeadingMode>
    </wpml:globalWaypointHeadingParam>
    <wpml:globalWaypointTurnMode>toPointAndStopWithDiscontinuityCurvature</wpml:globalWaypointTurnMode>
    <Placemark>
      <Point>
        <!-- Fill longitude and latitude here -->
        <coordinates>
          longitude,latitude
        </coordinates>
      </Point>
      <wpml:index>0</wpml:index>
      <wpml:ellipsoidHeight>90.2</wpml:ellipsoidHeight>
      <wpml:height>100</wpml:height>
      <wpml:useGlobalHeight>1</wpml:useGlobalHeight>
      <wpml:useGlobalSpeed>1</wpml:useGlobalSpeed>
      <wpml:useGlobalHeadingParam>1</wpml:useGlobalHeadingParam>
      <wpml:useGlobalTurnParam>1</wpml:useGlobalTurnParam>
      <wpml:gimbalPitchAngle>0</wpml:gimbalPitchAngle>
    </Placemark>
    <Placemark>
      <Point>
        <!-- Fill longitude and latitude here -->
        <coordinates>
          longitude,latitude
        </coordinates>
      </Point>
      <wpml:index>1</wpml:index>
      <wpml:ellipsoidHeight>90.2</wpml:ellipsoidHeight>
      <wpml:height>100</wpml:height>
      <wpml:useGlobalHeight>1</wpml:useGlobalHeight>
      <wpml:useGlobalSpeed>1</wpml:useGlobalSpeed>
      <wpml:useGlobalHeadingParam>1</wpml:useGlobalHeadingParam>
      <wpml:useGlobalTurnParam>1</wpml:useGlobalTurnParam>
      <wpml:gimbalPitchAngle>0</wpml:gimbalPitchAngle>
      <!-- Declare action group for waypoint 1# -->
      <wpml:actionGroup>
        <wpml:actionGroupId>0</wpml:actionGroupId>
        <wpml:actionGroupStartIndex>1</wpml:actionGroupStartIndex>
        <wpml:actionGroupEndIndex>1</wpml:actionGroupEndIndex>
        <wpml:actionGroupMode>sequence</wpml:actionGroupMode>
        <wpml:actionTrigger>
          <wpml:actionTriggerType>reachPoint</wpml:actionTriggerType>
        </wpml:actionTrigger>
        <!-- Declare the 1st action: rotate gimbal -->
        <wpml:action>
          <wpml:actionId>0</wpml:actionId>
          <wpml:actionActuatorFunc>gimbalRotate</wpml:actionActuatorFunc>
          <wpml:actionActuatorFuncParam>
            <wpml:gimbalRotateMode>absoluteAngle</wpml:gimbalRotateMode>
            <wpml:gimbalPitchRotateEnable>0</wpml:gimbalPitchRotateEnable>
            <wpml:gimbalPitchRotateAngle>0</wpml:gimbalPitchRotateAngle>
            <wpml:gimbalRollRotateEnable>0</wpml:gimbalRollRotateEnable>
            <wpml:gimbalRollRotateAngle>0</wpml:gimbalRollRotateAngle>
            <wpml:gimbalYawRotateEnable>1</wpml:gimbalYawRotateEnable>
            <wpml:gimbalYawRotateAngle>30</wpml:gimbalYawRotateAngle>
            <wpml:gimbalRotateTimeEnable>0</wpml:gimbalRotateTimeEnable>
            <wpml:gimbalRotateTime>0</wpml:gimbalRotateTime>
            <wpml:payloadPositionIndex>0</wpml:payloadPositionIndex>
          </wpml:actionActuatorFuncParam>
        </wpml:action>
        <!-- Declare the 2nd action: take photo -->
        <wpml:action>
          <wpml:actionId>1</wpml:actionId>
          <wpml:actionActuatorFunc>takePhoto</wpml:actionActuatorFunc>
          <wpml:actionActuatorFuncParam>
            <wpml:fileSuffix>point1</wpml:fileSuffix>
            <wpml:payloadPositionIndex>0</wpml:payloadPositionIndex>
          </wpml:actionActuatorFuncParam>
        </wpml:action>
      </wpml:actionGroup>
    </Placemark>
  </Folder>
 
</Document>
</kml>

Element Description

Create information (parent element: <Document>)

ElementDescriptionTypeUnitValueIs it required (default)Product Support
wpml:authorAuthorString--None, not requiredM300RTK, M30 Series
wpml:createTimeFile creation time (Unix Timestamp)Integerms-None, not requiredM300RTK, M30 Series
wpml:updateTimeFile update time (Unix Timestamp)Integerms-None, not requiredM300RTK, M30 Series

Mission information (parent element: <wpml:missionConfig>)

ElementDescriptionTypeUnitValueIs it required (default)Product Support
wpml:flyToWaylineModeFly to first waypoint modestring enumerate-safely: The aircraft in safe mode
(M300) takes off, ascends to the altitude of the first waypoint, and then flies level to the first waypoint. If the first waypoint is lower than the take-off point, after takeoff, it will level fly to the top of the first waypoint and then descend.
(M30) The aircraft takes off, rises to the altitude of the first waypoint, and then flies level to the first waypoint. If the first waypoint is lower than the "safe take-off altitude", after taking off to the "safe take-off altitude", level flight to the first waypoint and then descend. Note that the "safe takeoff altitude" only takes effect when the aircraft is not taking off.

pointToPoint: In tilt flight mode
(M300), after the aircraft takes off, it tilts to the first waypoint.
(M30) The aircraft takes off to the "safe take-off altitude", and then ramps to the first waypoint. If the altitude of the first waypoint is lower than the "safe take-off altitude", it will first level flight and then descend.
RequiredM300RTK, M30 Series
wpml:finishActionThe action when finish missionstring enumerate-goHome: After the aircraft completes the route task, exit the route mode and return to home. noAction: After the aircraft completes the route task, it exits the route mode.
autoLand: After the aircraft completes the route task, it exits the route mode and lands on the spot.
gotoFirstWaypoint: After the aircraft completes the route task, it will immediately fly to the starting point of the route, and exit route mode when it arrives.
Note: During the execution of the above actions, if the aircraft exits the route mode and enters the runaway state, the runaway action will be executed first.
RequiredM300RTK, M30 Series
wpml:exitOnRCLostWhether to continue to execute the route out of controlstring enumerate-goContinue:继续执行航线
executeLostAction:退出航线,执行失控动作
goContinue: Continue to execute the route
executeLostAction: Exit the route and execute the runaway action
RequiredM300RTK, M30 Series
wpml:executeRCLostActionType of disconnect actionstring enumerate-goBack: Go back. The aircraft is flying from the out-of-control position to the take-off point
landing: landing. The aircraft landed in place from an out-of-control position
hover: hover. The aircraft is hovering from an out-of-control position
goBackM300RTK, M30 Series
wpml:takeOffSecurityHeightSafe takeoff altitudeFloatm[1.5, 1500] (Altitude mode: relative to takeoff point altitude)
Note: After the aircraft takes off, climb to this altitude first, and then fly to the first waypoint according to the setting of "Fly to the first waypoint mode". This element only takes effect when the aircraft is not taking off.
1.5M30 Series
wpml:globalTransitionalSpeedGlobal route transition speedFloatm/s> 0
Note: The speed at which the aircraft flies to the first waypoint of each route. When the route mission is interrupted, the speed of the aircraft recovering from the current position to the interruption point.
RequiredM300RTK, M30 Series
wpml:takeOffRefPoint<x,y,z>reference take-off pointFloat°,°,m[-90,90],[-180,180],unlimited
Note: "Reference Takeoff Point" is only for reference of route planning. When the aircraft executes the route, the actual takeoff point of the aircraft shall prevail, and the height of the ellipsoid shall be used.
None,Not RequiredM30 Series
wpml:takeOffRefPointAGLHeightThe altitude of the reference take-off pointFloatmNote: The altitude of "reference take-off point" corresponds to the ellipsoid height in "reference take-off point".None,Not RequiredM30 Series
wpml:droneInfoAircraft type information----M300RTK, M30 Series
wpml:payloadInfoPayload information----M300RTK, M30 Series

Template information (parent element: <Folder>)

Template common elements(parent element:<Folder>

ElementDescriptionTypeUnitValueIs it required (default)Product Support
wpml:templateTypePredefined Template Type
Note: Templates provide users with a solution for quickly generating routes. The user fills in the template Element, and then imports the DJI support client (such as DJI Pilot) to quickly generate an executable mapping/inspection route.
string enumerate-waypoint
mapping2d
mapping3d
mappingStrip
RequiredM300RTK, M30 Series
wpml:templateIdTemplate ID
Note: This ID is unique within a kmz file. It is recommended to start monotonically and continuously increase from 0. In the template.kml and waylines.wpml files, this id will be used to associate the template with the generated executable routes.
Integer-[0, 65535]RequiredM300RTK, M30 Series
wpml:autoFlightSpeedGlobal flight speedFloatm/s(0, the maximum flight speed]
Note: The maximum flight speed of different models is different. This Element defines the target flight speed of the aircraft in the entire route generated by this template. If an additional The Element of the waypoint, the local definition will override the global definition.
RequiredM300RTK, M30 Series
wpml:waylineCoordinateSysParamCoordinate system parameters----M300RTK, M30 Series
wpml:payloadParamPayload parameters----M300RTK, M30 Series

Waypoint Flight Template Element (Parent Element: <Folder>)

ElementDescriptionTypeUnitValueIs it required (default)Product Support
wpml:globalWaypointTurnModeGlobal Waypoint Type (Global Waypoint Turn Mode)string enumerate-coordinateTurn: Coordinate turn, but point, turn ahead
toPointAndStopWithDiscontinuityCurvature: Fly in a straight line, the aircraft will stop at the point
toPointAndStopWithContinuityCurvature: curve flight, the aircraft will stop at the point
toPointAndPassWithContinuityCurvature: Curve flight, the aircraft will stop at the point
RequiredM300RTK, M30 Series
wpml:globalUseStraightLineWhether the global segment trajectory is as close to a straight line as possibleBoolean0: The trajectory of the flight segment is a curve in the whole process
1: The trajectory of the flight segment should be as close as possible to the line connecting the two points
Required
Note: Required if and only if "wpml:globalWaypointTurnMode" is set to "toPointAndStopWithContinuityCurvature" or "toPointAndPassWithContinuityCurvature". If the Element of a waypoint is additionally defined, the local definition will override the global definition.
M30 Series
wpml:gimbalPitchModeGimbal Pitch Control Modestring enumerate-manual: Manual control. When the aircraft is flying from one waypoint to the next, the user can manually control the pitch angle of the gimbal; if there is no user control, the gimbal pitch angle when flying away from the waypoint is maintained.
usePointSetting: Set according to each waypoint. When the aircraft flies from one waypoint to the next, the pitch angle of the gimbal transitions evenly to the pitch angle of the next waypoint.
RequiredM300RTK, M30 Series
wpml:ellipsoidHeightGlobal route height (ellipsoid height)
Note: This Element is used in conjunction with "wpml:height", which are expressions of different elevation reference planes at the same location.
Floatm-RequiredM300RTK, M30 Series
wpml:heightGlobal route height (EGM96 altitude/relative take-off point height/AGL relative ground height)
Note: This Element is used in conjunction with "wpml:ellipsoidHeight", which are expressions of different elevation reference planes at the same location.
Floatm-RequiredM300RTK, M30 Series
wpml:globalWaypointHeadingParamGlobal yaw angle mode parameters----M300RTK, M30 Series
Placemark(Point)Waypoint information (including waypoint latitude, longitude and altitude, etc.)----M300RTK, M30 Series

Mapping Aerial Template Element (Parent Element: <Placemark>)

ElementDescriptionTypeUnitValueIs it required (default)Product Support
wpml:caliFlightEnableWhether to enable calibration flight
* Note: only applicable to M300RTK and L1 models
Boolean-0: Disable
1: Enable, the inertial navigation calibration is automatically performed on the route to ensure the accuracy of the model. At the end of the route, there will be three acceleration and deceleration flights, and the curve of the route will automatically expand outward for acceleration and deceleration flight. If the route is too long, the acceleration and deceleration will be evenly inserted, and the flight time will not exceed 100s after each calibration.
-M300RTK
wpml:elevationOpimizeEnableWhether to enable elevation optimizationBoolean-0: Disable
1: Enable, the aircraft will fly to the center of the survey area to collect a set of tilted photos after the flight route is completed to optimize the elevation accuracy.
RequiredM300RTK, M30 Series
wpml:smartObliqueEnableWhether to enable Smart Posing
Note: Only applicable to M300RTK and P1 models
Boolean-0: Disabled
1: Enabled, the aircraft can take orthophoto and oblique photos by swinging the gimbal during a single aerial photography task.
-M300RTK
wpml:smartObliqueGimbalPitchSmart Pose Shooting Pitch Angle
Note: Only applicable to M300RTK and P1 models. The recommended input range of the P1 model gimbal is [-90, -45].
Integer°Corresponding model gimbal swivel range-M300RTK
wpml:shootTypePhoto mode (timed or fixed distance)string enumerate-time: take photos at equal time
distance: take photos at equal intervals
Note: It is recommended to use "time" to take photos at equal time. Define "photographing mode", "overlap rate" and "flying speed" in the template.kml file, and write the interval time or interval distance after calculation into wayslines.wpml.
RequiredM300RTK, M30 Series
wpml:directionroute directionInteger°[0, 360]RequiredM300RTK, M30 Series
wpml:marginExpansion distance outside the survey areaIntegerm-RequiredM300RTK, M30 Series
wpml:overlapOverlap rate parameter----M300RTK, M30 Series
wpml:ellipsoidHeightGlobal route height (ellipsoid height)
Note: This Element is used in conjunction with "wpml:height", which are expressions of different elevation reference planes at the same location.
Floatm-RequiredM300RTK, M30 Series
wpml:heightGlobal route height (EGM96 altitude/relative take-off point height/AGL relative ground height)
Note: This Element is used in conjunction with "wpml:ellipsoidHeight", which are expressions of different elevation reference planes at the same location.
Floatm-RequiredM300RTK, M30 Series
PolygonSurvey area polygon
Note: The format here is "<Polygon> <outerBoundaryIs> <LinearRing> <coordinates> longitude,latitude,0 longitude,latitude,0 longitude,latitude,0 </coordinates> </LinearRing> </outerBoundaryIs> </Polygon>
----M300RTK, M30 Series

Oblique Photography Template Element (Parent Element: <Placemark>)

ElementDescriptionTypeUnitValueIs it required (default)Product Support
wpml:caliFlightEnableWhether to enable calibration flight
Note: only applicable to M300RTK and L1 models
Boolean-0: Disable
1: Enable, the inertial navigation calibration is automatically performed on the route to ensure the accuracy of the model. At the end of the route, there will be three acceleration and deceleration flights, and the curve of the route will automatically expand outward for acceleration and deceleration flight. If the route is too long, the acceleration and deceleration will be evenly inserted, and the flight time will not exceed 100s after each calibration.
-M300RTK
wpml:inclinedGimbalPitchGimbal pitch angle (tilt)Integer°Note: The rotation range of different gimbal is different. The oblique photography template will be generated with five routes, one of which captures orthophoto images and four of which capture oblique images. This Element is used to set the tilt angle of the gimbal during oblique image capture.RequiredM300RTK, M30 Series
wpml:inclinedFlightSpeedroute flight speed (tilt)Floatm/s(0, the maximum flight speed of this aircraft ]
Note: The maximum flight speed of different aircraft types is different. The oblique photography template will generate five routes, of which 1 captures orthophoto images and 4 captures oblique images. Element is used to set the flying target speed during oblique image acquisition.
RequiredM300RTK, M30 Series
wpml:shootTypePhoto mode (timed or fixed distance)string enumerate-time: take photos at equal time
distance: take photos at equal intervals
Note: It is recommended to use "time" to take photos at equal time. Define "photographing mode", "overlap rate" and "flying speed" in the template.kml file, and write the interval time or interval distance after calculation into wayslines.wpml.
RequiredM300RTK, M30 Series
wpml:directionroute directionInteger°[0, 360]RequiredM300RTK, M30 Series
wpml:marginExpansion distance outside the survey areaIntegerm-RequiredM300RTK, M30 Series
wpml:overlapOverlap rate parameter----M300RTK, M30 Series
wpml:ellipsoidHeightGlobal route height (ellipsoid height)
Note: This Element is used in conjunction with "wpml:height", which are expressions of different elevation reference planes at the same location.
Floatm-RequiredM300RTK, M30 Series
wpml:heightGlobal route height (EGM96 altitude/relative take-off point height/AGL relative ground height)
Note: This Element is used in conjunction with "wpml:ellipsoidHeight", which are expressions of different elevation reference planes at the same location.
Floatm-RequiredM300RTK, M30 Series
PolygonSurvey area polygon
Note: The format here is "<Polygon> <outerBoundaryIs> <LinearRing> <coordinates> longitude,latitude,0 longitude,latitude,0 longitude,latitude,0 </coordinates> </LinearRing> </outerBoundaryIs> </Polygon>
----M300RTK, M30 Series

Strip Flight Template Element (Parent Element: <Placemark>)

ElementDescriptionTypeUnitValueIs it required (default)Product Support
wpml:caliFlightEnableWhether to enable calibration flightBoolean-0:Disable
1:Enable
RequiredM300RTK, M30 Series
wpml:shootTypePhoto mode (timed or fixed distance)string enumerate-time: take photos at equal time
distance: take photos at equal intervals* Note: It is recommended to use "time" to take photos at equal time. Define "photographing mode", "overlap rate" and "flying speed" in the template.kml file, and write the interval time or interval distance after calculation into wayslines.wpml.
RequiredM300RTK, M30 Series
wpml:directionroute directionInteger°[0, 360]RequiredM300RTK, M30 Series
wpml:marginExpansion distance outside the survey areaFloatm-RequiredM300RTK, M30 Series
wpml:singleLineEnableWhether to enable single route flightBoolean-0:disable
1:enable
RequiredM300RTK, M30 Series
wpml:cuttingDistanceRoute length of each sub stripFloatm-RequiredM300RTK, M30 Series
wpml:boundaryOptimEnableWhether to enable edge optimizationBoolean-0:disable
1:enable
RequiredM300RTK, M30 Series
wpml:leftExtendExtending distance on the left side of the strip flightIntegerm-RequiredM300RTK, M30 Series
wpml:rightExtendExtending distance on the right side of the strip flightIntegerm-RequiredM300RTK, M30 Series
wpml:includeCenterEnablewhether to include centerlineBoolean-0:not include
1:include
RequiredM300RTK, M30 Series
wpml:overlapOverlap rate parameter----M300RTK, M30 Series
wpml:ellipsoidHeightGlobal route height (ellipsoid height)
Note: This Element is used in conjunction with "wpml:height", which are expressions of different elevation reference planes at the same location.
Floatm-RequiredM300RTK, M30 Series
wpml:heightGlobal route height (EGM96 altitude/relative take-off point height/AGL relative ground height)
Note: This Element is used in conjunction with "wpml:ellipsoidHeight", which are expressions of different elevation reference planes at the same location.
Floatm-RequiredM300RTK, M30 Series
LineStringWaypoint information
Note: The format here is "<LineString> <coordinates> longitude,latitude,0 longitude,latitude,0 longitude,latitude,0 </coordinates> </LineString>"
----M300RTK, M30 Series