Skip to content

Instantly share code, notes, and snippets.

@cmdelaserna
Last active December 12, 2015 03:28
Show Gist options
  • Save cmdelaserna/4706818 to your computer and use it in GitHub Desktop.
Save cmdelaserna/4706818 to your computer and use it in GitHub Desktop.
Simple sketch to get data from a CartoDB table into Processing
import org.json.*;
/*
CartoDB API
Simple skecth to get data from a table
Processing 1.5
*/
//define API call
String api = "https://viz2.cartodb.com/api/v2/sql?q="; //CartoDB table
String query = "SELECT%20pop2005%20FROM%20forestdata"; //define query
String file;
void setup(){
getCartodbData();
}
void getCartodbData() {
String request = api + query;
file = join(loadStrings(request), "");
println(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment