0

I would like to add drone.latitude, drone.longitude and track to fieldName, but I can't find a way to do it. This is what I have tried so far for the track parameter, but nothing shows up.

This is just a piece of my code, I hope it is enough to understand my problem.

top.drawDrones = function() {

  //console.log("Drawing " + Object.keys(top.drones).length + " drones" );
  view.graphics.removeAll();
  dataObject.dataPoints.splice(0, dataObject.dataPoints.length);
  customMarkers.splice(0, customMarkers.length)
  //console.log(customMarkers.length)

  for (const [drone_name, drone_list] of Object.entries(top.drones)) {

    const drone = drone_list[drone_list.length-1];
    const track = drone.track
    let trackstr: string= "track"
    const X_zoom = drone.X_zoom
    const Y_zoom = drone.Y_zoom
    const Z_zoom = drone.altitude
    const Flarm_name = drone.name
    const diretion = drone.diretion
    const point = new Point({
      x: drone.longitude,
      y: drone.latitude,
    });

    // Draw line


    if (drone_list.length > 0) {

      var drone_path = []
      var i:number; 
      for(i=0; i<drone_list.length; i++) {

        const position = drone_list[i];

        drone_path.push([position.longitude, position.latitude])
      }
      drone_path=drone_path.slice(-100)
      var polyline = new Polyline({
        hasZ: false,
        hasM: true,
        paths : drone_path,
        spatialReference: { wkid: 4326 }
      }); 
      var template = new PopupTemplate({
        title: drone_name,
        content: [
          {
            type: "fields",
            fieldInfos: [
              {
                fieldName: track,
                visible: true,
                label: "Track",
                format: {
                  digitSeparator: true,
                  places: 0,
                  type: "oid"
                }
              }

            ]
          }
        ]
    });

Please give me some help as I already tried a lot of different ways to do it. I'm new to ArcGIS and to JavaScript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.