AnsweredAssumed Answered

Use turf for bezier the line?

Question asked by crecendia on Jul 16, 2017
Latest reply on Jul 17, 2017 by TSolow-esristaff

I'm planning to apply turf to bezier the line. The line has been stated before, but seems like the line isn't rendered to curved.

 

Let's check out my code.

 

//======= Load data Polyline ==========
          var line = new Polyline(wgs84);
          var b = 0;
          var a = 0;
             // console.log(hasilarray);
          arrayUtils.forEach(hasilarray, function(ple){
            // console.log();
            if(a==0){
              var jumlah = akhir.length;
              for(c=0;c<jumlah;c++){
                var load = JSON.stringify(hasilarray[0][c]);
                console.log(load +" jalur "+c);
                var jumlah_k = hasilarray[0][c].length;
                for(d=0;d<jumlah_k;d++){
                  // array_koordinat.push(hasilarray[0][c][d]);
                  var koor_x_p = hasilarray[1][d][0].toString();
                  var koor_y_p = hasilarray[1][d][1].toString();
                  var x_ = Number(koor_x_p);
                  var y_ = Number(koor_y_p);
                  array_koordinat.push(x_,y_);
                  koordinat_a.push(array_koordinat);
                  array_koordinat=[];
                }
                line.addPath(hasilarray[0][c]);
              }
            }else{
              var load = JSON.stringify(hasilarray[1]);
              // console.log(JSON.stringify(hasilarray[1]));
              //console.log(load +" jalur terakhir");
              var jumlah_k = hasilarray[1].length;
              for(e=0;e<jumlah_k;e++){
                  var koor_x_p = hasilarray[1][e][0].toString();
                  var koor_y_p = hasilarray[1][e][1].toString();
                  var x_ = Number(koor_x_p);
                  var y_ = Number(koor_y_p);
                  array_koordinat.push(x_,y_);
                  koordinat_a.push(array_koordinat);
                  array_koordinat=[];
                }
              // array_koordinat.push(hasilarray[1]);
              line.addPath(hasilarray[1]);


            }
            a++;
            b++;
          }) ;


          console.log(JSON.stringify(koordinat_a));




         /* var lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0,0.5]),3);     
          map.graphics.add(new esri.Graphic(line, lineSymbol));*/



          var bg = new Graphic(line, basicSymbol, {}, null);


                    graphicsLayer.add(bg);


                    showEndSymbol.push(basicSymbol);     

 

Where should I put the turf bezier function so it can be showed and rendered on the view? Thanks.

Outcomes