40.pilot-map-elements

Function Overview

The Map Elements is a function that can synchronize points, lines, and polygons from the DJI Pilot 2 map to the cloud server. To achieve a real-time tactical layout, it gives the commander/host the ability to share the layers with DJI Pilot 2 through the web browser. On the other side, DJI Pilot 2 can also share the signs to the web end to help the commander/host have more information. In addition, the platform also can distribute the layers from one DJI Pilot 2 to another different DJI Pilot 2 during the mission.

Notes:

  1. Please set up the workspace. The DJI Pilot 2 only starts synchronizing the workspace's elements once the setup is complete.

  2. Different remote controllers will synchronize the map elements automatically without the transference from the Server end.

  3. If an aircraft connect with two remote controller A and B and only remote B has connected with Server, the new point/sign/mark from the remote controller A would synchronize with remote controller B first. Then the remote controller B will upload the point to the server end.

  4. The latitude and longitude coordinates of map elements use the WGS84 coordinate system. If the Web terminal uses Baidu, AutoNavi, etc., coordinate conversion is required.

a2bf8c83-0da1-3c94-80ff-f02714565d69.png
ed100352-1dba-349f-9907-b20eb89d9bfd.png

Legend: DJI Pilot 2 Map UI

2322d303-be34-35bf-93b0-6a5f0a0eaa13.png

Legend: Web map page

Interaction Sequence Diagram

sequenceDiagram

participant h5 as Pilot2 Webview
participant app as DJI Pilot 2
participant cloud as Cloud Server
participant web as Web Page
h5 ->> cloud:Log in to 3rd party clould platform
note over app, h5: Need to setup workspaceId, load api, ws module
h5 ->> app: Load api module 
h5 ->> app: Load Ws module
app ->> cloud: Connect Websocket
cloud -->> app:Connected
h5 ->> app: Setup workspace information
h5 ->> app:Load map element MAP module
note over app,cloud: First time log in, obtain all map elements list

app ->> cloud: Obtain element list
cloud -->> app:Return to the list
web ->> cloud: Obtain element list
cloud -->> web:Return to the list

note over app,web:Create, update, delete element
app ->> app: Create, update, delete point/line/polygon element under DJI Pilot 2 map
app ->> cloud: Send create, update, delet element request
cloud -->> app:Respond
cloud ->>web: Websocket notices web-end to create, update, and delete element
web ->> web: Create, update, delete point/line/polygon element under web-end map
web ->> cloud: Send create, update, delet element request
cloud -->> web:Respond
cloud ->>app: Websocket notices Pilot2 to create, update, and delete element

note over app, web:Refresh layer
web  ->> web:Layer element drag update
web ->> cloud:Update layer info
cloud ->> app: websocket send layer update info
app ->> cloud: Obtain new(updated) map element list
cloud -->> app: Return to element list

Detailed API Realization

  • JSBridge

    • Load DJI Pilot 2 Map Element Module window.djiBridge.platformLoadComponent(String name, String param) Before using the map element function, developers need to set up the workspaceId, configure the Ws module and api module, and then load the DJI Pilot 2 map module. Also, developers can consider adding the loading interface of map module in log-in phase.

  • Map Element (HTTPS)

    • Obtain Map Element List In the first connection, DJI Pilot 2 will send out an http request to obtain the map element list. On the server end, it needs to synchronize the map element list to DJI Pilot 2. Also, if it receives a layer refresh instruction from WebSocket, it needs the same interface to request the map element list.

      Note: The list has to have the APP sharing layer, otherwise the successor element cannot be synchronized to the server.

    • New Map Element Request When user draws a point, line or polygon on the Pilot2/Web side, it will send out a new map element request to the server end. Then the server end will respond after receiving the request.

    • Map Element Update Request When user draws a point, line or polygon on the Pilot2/Web side, it will send out a map element update request to the server end. Then the server end will respond after receiving the request.

    • Delete Map Element Request When user deletes a point, line or polygon on the Pilot2/Web side, it will send out a delete map element request to the server end. Then the server end will respond after receiving the request.

  • Map Element (WebSocket)

    • Refresh Map Element List Push When several elements have changed on the server end, such as drag an element on web end, the user end can be notified through WebSocket. The downward parameter has the layer group_id. The user end can call "Obtain Map Element List" to refresh the element list through http after receiving the ID.

    • New/Update/Delete Map Element Push After receiving the new/update/delete map element request from Pilot2/Web end, the server end will update the stored element and will notify all terminal in the same workspace.

Last updated