Please help! Processing is showing loadTable is not defined?

Want to import csv data in Processing but it is showing loadTable is not defined…

Error:

jQuery.Deferred exception: loadTable is not defined

ReferenceError: loadTable is not defined
at Processing.Processing.setup (eval at attach (https://preview.openprocessing.org/assets/js/vendor/processingjsReleases/processing-1.6.6.js?version=7.42:885:22), <anonymous>:15:4)
at executeSketch (https://preview.openprocessing.org/assets/js/vendor/processingjsReleases/processing-1.6.6.js?version=7.42:21596:24)
at new Processing.Processing (https://preview.openprocessing.org/assets/js/vendor/processingjsReleases/processing-1.6.6.js?version=7.42:21623:7)
at HTMLDocument.<anonymous> (https://preview.openprocessing.org/sketch/preview/?random=0.8655151487995074:44:6)
at l (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29375)
at c (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29677)

undefined

Uncaught ReferenceError: loadTable is not defined[Show stack](https://openprocessing.org/sketch/1221838#)

Show your code/ link

float angle;

float lat = -37.8136;
float lon = 144.9631;

Table table;

void setup() {
	size(600, 600, P3D);
	table = loadTable("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_day.csv", "csv", "header");
}

void draw() {
	background(51);
	translate(width/2, height/2);
	
	rotateY(angle);
	angle += 0.05;
	
	lights();
	fill(200);
	noStroke();
	float r = 200;
	sphere(r);
	
	for (TableRow row : table.rows()) {
		float lat = row.getFloat("latitude");
		float lon = row.getFloat("longitude");
		float mag = row.getFloat("mag");
		println(lat, lon, mag);
	}
	
	float theta = radians(lat) + PI/2;
	float phi = radians(lon) + PI;
	float x = r * sin(theta) * cos(phi);
	float y = -r * sin(theta) * sin(phi);
	float z = r * cos(theta);
	
	translate(x, y, z);
	box(10);
}

@Chrisir I want to work with data visualization on the globe, and my work is very similar to mapping these earthquake data on the globe, but I cannot load any CSV file into it.

Hello,

Try this:
table = loadTable("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_day.csv", "header");

:)

Hi @glv I initially tried the same thing but still it is showing the same error.

Hello,

Both of these work for me:

table = loadTable("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_day.csv", "header");

I downloaded and put in the sketch folder in /data:

table = loadTable("significant_day.csv", "header");

Try running this in Processing on the desktop.

You may not be able to access data from from a URL in OpenProcessing; I have not been able to last time I tried.

:)

Hi @glv I am new with processing well I am using processing online editor maybe that’s why it’s not working for me.

Answered in last post… I updated it.

Then can you please tell me how to use it.

Processing can be downloaded from here:
https://processing.org/

There are also resources on the website to help you.

:)

Thank you so much @glv for the help

1 Like

Loading resources from URL used to be fine and dandy, but nowadays, they are blocked by CORS (the headers at the server end).

Your code runs fine in the Desktop IDE.

3 Likes