{
const canvas = DOM.canvas(width, height);
var context = canvas.getContext("2d");
context.lineWidth = 2;
for (var poly of polys){
context.fillStyle = gradientscale(poly.centroid.y / height)
context.strokeStyle = "#eef4ed"
context.beginPath();
var iii = 0;
for( let P of poly.polygon ) {
if(iii==0){
context.moveTo( P.x, P.y );
}else{
context.lineTo( P.x, P.y );
}
iii++;
}
var P0 = poly.polygon[0];
context.lineTo( P0.x, P0.y );
context.fill();
context.stroke();
const centroid = poly.centroid
context.fillStyle = "#eef4ed"
context.beginPath();
context.arc(centroid.x, centroid.y, 2, 0, 2 * Math.PI);
context.fill();
}
const shrink = 0.4;
const canvas_small = DOM.canvas(width*shrink, height*shrink);
var context_small = canvas_small.getContext("2d");
context_small.drawImage(canvas, 0, 0, width*shrink, height*shrink);
return canvas_small
}