NaN Problem

Hey, I'm trying to make a data visualization with a dataset about central power stations, that I put here, but when I try to visualize there are few power station "ball". When I try to understand the problem with Println(longitude), it tells me "map(NaN, -180, 180, 0, 1000) called, which returns NaN (not a number)". I think that the code is right, and I don't understand the problem with the .csv. Thank You!

https://docs.google.com/spreadsheets/d/1B6ezcmjntEI-nI6_miO6UQaOU78ZXnDep-qtyVUWmJ4/edit?usp=sharing

PImage mappa; 
Table dati;

void setup(){
  size(1000, 500); 
  mappa= loadImage("world.png"); 
  dati= loadTable("energydata.csv", "header"); 
}

void draw(){
image(mappa, 0, 0, width, height);


 for( int riga=0; riga < dati.getRowCount(); riga++){
float lat= dati.getFloat(riga,0); 
float lon= dati.getFloat(riga,1); 
/*String nome = dati.getString(riga,2);
String stato = dati.getString(riga,3);
float potenza= dati.getFloat(riga,4);
String tipo= dati.getString(riga,5);


float la=map(lat, 90, -90, 0, height);
float lo=map(lon, -180,180,0,width);
println(lon);

fill(#4AF2A1,80);
noStroke();
ellipse(lo,la,10,10);

noLoop();  }}

Answers

Sign In or Register to comment.