Welcome to Advanced Interactive Web Mapping, Programming, and Design, Class 3
This is a web page that can be viewed as slides.
→ to move forward
← to go back
Class 3
Please install OpenRefine (openrefine.org) while you wait for class to start.
(the "nubby bits")
(the "nubby bits")
(makin' stuff)
https://{account}.cartodb.com/api/v2/sqlhttps://eric.cartodb.com/api/v2/sqlq parameter that expects an SQL queryq=SELECT count(*) FROM {table_name}? in a url lets the server know that the parameters start thereendpoint + ? + parametershttps://{account}.cartodb.com/api/v2/sql?q=SELECT count(*) FROM {table_name}https://eric.cartodb.com/api/v2/sql?q=SELECT count(*) FROM listings$.getJSON$.getJSONgets JSON data from a url in jQuery
$.getJSON(url)$.getJSON(url)
  .done(function (data) {
    // Do something with the data
  });$('.colors').change(function () {
  $('.box').css({
    'background-color': $(this).val()
  });
});$('.colors').change(function () {
  // Do something with the 
  // colors input
});$.getJSON(url)
  .done(function (data) {
    // Do something with the data
  });$.getJSON(url)
  .done(function (data) {
    // Do something with the data
  });only called if the request is done at some point
&http://...cartodb.com/.../sql?
  q={query}&
  format=GeoJSON$.param$.param({
  q: <your sql>,
  format: 'GeoJSON'
})$.param({
  q: <your sql>,
  format: 'GeoJSON'
})q=<your sql>&format=GeoJSONvar total = 1021;
$('.total').text(total);
[...]
<div>total:
  <span class="total"></span>
</div>$('body').append(
    $('<div></div>').text('oh hi');           
);$.each$.each$.each(array, function);var names = [...];
$.each(names, function () {
  // this contains
  // the value you're on
});var names = [...];
$.each(names, function () {
  // this contains
  // the value you're on
  console.log(this);
});http://nominatim.openstreetmap.org/search?format=jsonv2&q=ISC%20Building%20Brooklyn