xxxxxxxxxx
46
let bg;
let latitudes = [];
let longitudes = [];
let minLatitude;
let maxLatitude;
let minLongitude;
let maxLongitude;
function preload() {
table = loadTable('stadiums.csv', 'csv', 'sheet1');
}
function setup() {
createCanvas(736, 588);
bg = loadImage('euro.jpeg');
for(let i = 1; i < table.rows.length; i++){
data = table.rows[i].arr;
latitudes.push(data[5]);
longitudes.push(data[6]);
}
minLatitude = min(latitudes);
maxLatitude = max(latitudes);
minLongitude = min(longitudes);
maxLongitude = max(longitudes);
console.log(longitudes[0]);
console.log(latitudes[0]);
}
function draw() {
background(120);
image(bg, 0, 0, bg.width, bg.height);
// fill("red");
// for(let i = 0; i < 164; i++){
// mappedX = map(latitudes[i], -90, 90, height, 0) * 3;
// mappedY = map(longitudes[i], -180, 180, 0, width) * 1.2;
// fill("white");
// ellipse(mappedX, mappedY, 3);
for (let i=0; i<164; i++){
stroke(random(255),random(255),random(255));
strokeWeight(6);
x=map(latitudes[i],90,0,0,width); //Mapping the latitude to the width of the canvas
y=map(longitudes[i],-180,180,0,height); //Mapping the longitude to the height of the canvas
point(x,y);
}
}