最终生成kml航线文件内容
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document xmlns="">
<name>航线1</name>
<open>1</open>
<ExtendedData xmlns:mis="www.dji.com">
<mis:type>Waypoint</mis:type>
<mis:stationType>0</mis:stationType>
</ExtendedData>
<Style id="waylineGreenPoly">
<LineStyle>
<color>FF0AEE8B</color>
<width>6</width>
</LineStyle>
</Style>
<Style id="waypointStyle">
<IconStyle>
<Icon>
<href>https://cdnen.dji-flighthub.com/static/app/images/point.png</href>
</Icon>
</IconStyle>
</Style>
<Folder>
<name>Waypoints</name>
<description>Waypoints in the Mission.</description>
<Placemark>
<name>Waypoint1</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="1" accuracy="0" cameraIndex="0" payloadType="0" payloadIndex="0">TimeIntervalShot</mis:actions>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4706343785,39.1425886906,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint2</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4716088749,39.1425604128,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint3</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4716480288,39.1423635558,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint4</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4698534762,39.1423907460,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint5</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4695271939,39.1421982395,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint6</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4718307469,39.1421634360,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint7</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4717807169,39.1419698419,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint8</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4687745694,39.1420057329,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint9</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4684635136,39.1418088759,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint10</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4713783021,39.1417697221,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint11</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4713391482,39.1415706899,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint12</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4676369317,39.1416152818,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint13</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4673389272,39.1414325637,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint14</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4702428397,39.1413847089,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint15</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4702036858,39.1411949214,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint16</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4664144607,39.1412367943,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint17</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4663067876,39.1410475506,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint18</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4690453837,39.1410105719,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint19</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4690497341,39.1408148025,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint20</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4661773622,39.1408430803,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint21</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4661751870,39.1406516614,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint22</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4679262354,39.1406277340,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint23</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4679262354,39.1404319646,55.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Waypoint24</name>
<visibility>1</visibility>
<description>Waypoint</description>
<styleUrl>#waypointStyle</styleUrl>
<ExtendedData xmlns:mis="www.dji.com">
<mis:useWaylineAltitude>true</mis:useWaylineAltitude>
<mis:heading>0</mis:heading>
<mis:turnMode>Auto</mis:turnMode>
<mis:gimbalPitch>-90.0</mis:gimbalPitch>
<mis:useWaylineSpeed>true</mis:useWaylineSpeed>
<mis:speed>4.5</mis:speed>
<mis:useWaylineHeadingMode>true</mis:useWaylineHeadingMode>
<mis:useWaylinePointType>true</mis:useWaylinePointType>
<mis:pointType>LineStop</mis:pointType>
<mis:cornerRadius>0.2</mis:cornerRadius>
<mis:actions param="900" accuracy="1" cameraIndex="0" payloadType="0" payloadIndex="0">GimbalYaw</mis:actions>
</ExtendedData>
<Point>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4662056400,39.1404537168,55.0</coordinates>
</Point>
</Placemark>
</Folder>
<Placemark>
<name>Wayline</name>
<description>Wayline</description>
<visibility>1</visibility>
<ExtendedData xmlns:mis="www.dji.com">
<mis:altitude>50.0</mis:altitude>
<mis:autoFlightSpeed>4.5</mis:autoFlightSpeed>
<mis:actionOnFinish>GoHome</mis:actionOnFinish>
<mis:headingMode>UsingInitialDirection</mis:headingMode>
<mis:gimbalPitchMode>UsePointSetting</mis:gimbalPitchMode>
<mis:powerSaveMode>false</mis:powerSaveMode>
<mis:flightCali>false</mis:flightCali>
<mis:waypointType>LineStop</mis:waypointType>
<mis:droneInfo>
<mis:droneType>PM430</mis:droneType>
<mis:droneCameras>
<mis:camera>
<mis:cameraIndex>0</mis:cameraIndex>
<mis:cameraName>Zenmuse H20T</mis:cameraName>
<mis:cameraType>43</mis:cameraType>
<mis:payloadCameraType>0</mis:payloadCameraType>
</mis:camera>
</mis:droneCameras>
<mis:droneHeight>
<mis:useAbsolute>false</mis:useAbsolute>
<mis:hasTakeoffHeight>false</mis:hasTakeoffHeight>
<mis:takeoffHeight>0.0</mis:takeoffHeight>
</mis:droneHeight>
</mis:droneInfo>
</ExtendedData>
<styleUrl>#waylineGreenPoly</styleUrl>
<LineString>
<tessellate>1</tessellate>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>118.4706343785,39.1425886906,55.0 118.4716088749,39.1425604128,55.0 118.4716480288,39.1423635558,55.0 118.4698534762,39.1423907460,55.0 118.4695271939,39.1421982395,55.0 118.4718307469,39.1421634360,55.0 118.4717807169,39.1419698419,55.0 118.4687745694,39.1420057329,55.0 118.4684635136,39.1418088759,55.0 118.4713783021,39.1417697221,55.0 118.4713391482,39.1415706899,55.0 118.4676369317,39.1416152818,55.0 118.4673389272,39.1414325637,55.0 118.4702428397,39.1413847089,55.0 118.4702036858,39.1411949214,55.0 118.4664144607,39.1412367943,55.0 118.4663067876,39.1410475506,55.0 118.4690453837,39.1410105719,55.0 118.4690497341,39.1408148025,55.0 118.4661773622,39.1408430803,55.0 118.4661751870,39.1406516614,55.0 118.4679262354,39.1406277340,55.0 118.4679262354,39.1404319646,55.0 118.4662056400,39.1404537168,55.0</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
具体实现代码如下:
/**
* coordinates(经纬度:经度,纬度,高度)代表一个地理信息的对象集合(自定义) 生成kml的名称
*
* @param coordinates
* @param filePath
* @return
* @throws IOException
*/
public static boolean setTravelsKml(String coordinates, String filePath) throws IOException {
String[] coordinatesArr = coordinates.split(" ");
File file = new File(filePath);
file.createNewFile();
Element root = DocumentHelper.createElement("kml");
Document document = DocumentHelper.createDocument(root);
//根节点添加属性
Namespace namespace = Namespace.get("http://www.opengis.net/kml/2.2");
root.addAttribute("xmlns", "http://www.opengis.net/kml/2.2");
root.add(namespace);
Element documentElement = root.addElement("Document");
documentElement.addElement("name").addText("指点飞行航线"); //名称
documentElement.addElement("open").addText("1");
Element extendedData = documentElement.addElement("ExtendedData");// Document标签中添加一个ExtendedData元素标签
Namespace mis = new Namespace("mis", "www.dji.com");
extendedData.addAttribute("xmlns:mis", "www.dji.com");
extendedData.addElement(new QName("type", mis)).addText("Waypoint");
extendedData.addElement(new QName("stationType", mis)).addText("0");
Element style = documentElement.addElement("Style");
style.addAttribute("id", "waylineGreenPoly");
Element lineStyle = style.addElement("LineStyle");
lineStyle.addElement("color").addText("FF0AEE8B");
lineStyle.addElement("width").addText("6");
Element style2 = documentElement.addElement("Style");
style2.addAttribute("id", "waypointStyle");
Element iconStyle = style2.addElement("IconStyle");
Element colorEl = iconStyle.addElement("color");
colorEl.addElement("href").addText("https://cdnen.dji-flighthub.com/static/app/images/point.png");
Element folderEl = documentElement.addElement("Folder");
folderEl.addElement("name").addText("Waypoints");
folderEl.addElement("description").addText("Waypoints in the Mission.");
// 航点数据组装
int index = 0;
for (String item : coordinatesArr) {
index++;
Element placeMark = folderEl.addElement("Placemark");
placeMark.addElement("name").addText("Waypoint" + index);
placeMark.addElement("visibility").addText("1");
placeMark.addElement("description").addText("Waypoint");
placeMark.addElement("styleUrl").addText("#waypointStyle");
Element extendedData1 = placeMark.addElement("ExtendedData").addAttribute("xmlns:mis", "www.dji.com");
Namespace nMis = new Namespace("mis", "www.dji.com");
extendedData1.addElement(new QName("useWaylineAltitude", nMis)).addText("true");
extendedData1.addElement(new QName("heading", nMis)).addText("0");
extendedData1.addElement(new QName("turnMode", nMis)).addText("Auto");
extendedData1.addElement(new QName("gimbalPitch", nMis)).addText("-90.0");
extendedData1.addElement(new QName("useWaylineSpeed", nMis)).addText("true");
extendedData1.addElement(new QName("speed", nMis)).addText("4.5");
extendedData1.addElement(new QName("useWaylineHeadingMode", nMis)).addText("true");
extendedData1.addElement(new QName("useWaylinePointType", nMis)).addText("true");
extendedData1.addElement(new QName("pointType", nMis)).addText("LineStop");
extendedData1.addElement(new QName("cornerRadius", nMis)).addText("0.2");
extendedData1.addElement(new QName("actions", nMis)).addAttribute("param", "1").addAttribute("accuracy", "0").addAttribute("cameraIndex", "0").addAttribute("payloadType", "0").addAttribute("payloadIndex", "0").addText("TimeIntervalShot");
extendedData1.addElement(new QName("actions", nMis)).addAttribute("param", "900").addAttribute("accuracy", "1").addAttribute("cameraIndex", "0").addAttribute("payloadType", "0").addAttribute("payloadIndex", "0").addText("GimbalYaw");
Element pointEl = placeMark.addElement("Point");
pointEl.addElement("altitudeMode").addText("relativeToGround");
pointEl.addElement("coordinates").addText(item);
}
Element placeMark1 = documentElement.addElement("Placemark");
placeMark1.addElement("name").addText("Wayline");
placeMark1.addElement("description").addText("Wayline");
placeMark1.addElement("visibility").addText("1");
Element extendedData2 = placeMark1.addElement("ExtendedData").addAttribute("xmlns:mis", "www.dji.com");
Namespace eMis = new Namespace("mis", "www.dji.com");
extendedData2.addElement(new QName("altitude", eMis)).addText("50.0");
extendedData2.addElement(new QName("autoFlightSpeed", eMis)).addText("4.5");
extendedData2.addElement(new QName("actionOnFinish", eMis)).addText("GoHome");
extendedData2.addElement(new QName("headingMode", eMis)).addText("UsingInitialDirection");
extendedData2.addElement(new QName("gimbalPitchMode", eMis)).addText("UsePointSetting");
extendedData2.addElement(new QName("powerSaveMode", eMis)).addText("false");
extendedData2.addElement(new QName("flightCali", eMis)).addText("false");
extendedData2.addElement(new QName("waypointType", eMis)).addText("LineStop");
Element droneInfoEl = extendedData2.addElement(new QName("droneInfo", eMis));
droneInfoEl.addElement(new QName("droneType", eMis)).addText("PM430");
Element droneCamerasEl = droneInfoEl.addElement(new QName("droneCameras", eMis));
Element cameraEl = droneCamerasEl.addElement(new QName("camera", eMis));
cameraEl.addElement(new QName("cameraIndex", eMis)).addText("0");
cameraEl.addElement(new QName("cameraName", eMis)).addText("Zenmuse H20T");
cameraEl.addElement(new QName("cameraType", eMis)).addText("43");
cameraEl.addElement(new QName("payloadCameraType", eMis)).addText("0");
Element droneHeightEl = droneInfoEl.addElement(new QName("droneHeight", eMis));
droneHeightEl.addElement(new QName("useAbsolute", eMis)).addText("false");
droneHeightEl.addElement(new QName("hasTakeoffHeight", eMis)).addText("false");
droneHeightEl.addElement(new QName("takeoffHeight", eMis)).addText("0.0");
placeMark1.addElement("styleUrl").addText("#waylineGreenPoly");
Element lineStringEl = placeMark1.addElement("LineString");
lineStringEl.addElement("tessellate").addText("1");
lineStringEl.addElement("altitudeMode").addText("relativeToGround");
lineStringEl.addElement("coordinates").addText(coordinates);
//创建kml到本地
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("UTF-8");
XMLWriter xmlWriter = new XMLWriter(new FileOutputStream(filePath), format);
xmlWriter.write(document);
xmlWriter.close();
return true;
}
测试入口:
public static void main(String[] args) {
try {
String filePath = "D:\\ShiKml\\" + "test" + ".kml";
setTravelsKml("132.457812,23.456784,55.0 132.457912,23.456484,55.0", filePath);
} catch (IOException e) {
throw new RuntimeException(e);
}
}