Last active
December 12, 2015 03:28
-
-
Save cmdelaserna/4706818 to your computer and use it in GitHub Desktop.
Simple sketch to get data from a CartoDB table into Processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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