Manually Create PolyData in vtk.js

Relative to this topic ‘Create polydata in vtk.js’, I am struggling with coding a polyData from a JSON file that represents continents.

Easy to read with d3.js, I cannot create a vtk.vtkAppendPolyData correctly.
Any help would be appreciated.





  
d3.queue()
        .defer(d3.json, "https://unpkg.com/world-atlas@1/world/50m.json")
	.awaitAll(function(error, data) {
        	if (error) throw error;
        	console.log('continents ---> Read');
        	console.log('################### finished');

               multilinestring = topojson.mesh(data[0], data[0].objects.land);

              var polydata = vtk({
		  vtkClass: 'vtkPolyData',
		  points: {
		    vtkClass: 'vtkPoints',
		    dataType: 'Float32Array',
		    numberOfComponents: 3
		  },
		  lines: {
		    vtkClass: 'vtkCellArray',
		    dataType: 'Uint16Array'
		  }
	       });

               appendPolydata = vtk.Filters.General.vtkAppendPolyData.newInstance();
	       for (var p=0; p < multilinestring.coordinates.length; p++) {
        	       line = multilinestring.coordinates[p];
  		       polygonpoints = [];
  		       polygonlines = [];
                       for (var i=0; i<line.length; i++) {
			    xyz = vertex(line[i], 1.001);    // calculate a projection (return xyz)
        		    polygonpoints.push(xyz[0], xyz[1], xyz[2]);
        		    polygonlines.push(i);
		     }
                     polydata.getPoints().setData(polygonpoints);
  		     polydata.getLines().setData(polygonlines);
                     appendPolydata.addInputConnection(polydata);	
                }

         // add mapper
        // add actor

         );  //await

I have done this in python and this was much easier. What am I missing ?