Fork me on GitHub

[Broken] Google Spreadsheet Full Import Test 1

Testing to get all the geoJSON data properly processed as a real object now

comment count

Test Case:

Testing to get all the geoJSON data properly processed as a real object now

Press [Command] + [Option] + [' i ']

If you're on a mac, to open the console and see the console.log()

You should be able to see one large object of ~67 objects coming from the google spreadsheet, and two arrays being displayed with two different versions of the column headers

Code:

<p>Testing to get all the geoJSON data properly processed as a real object now</p>
<h2>Press [Command] + [Option] + [' i ']</h2>
<p>If you're on a mac, to open the console and see the console.log()</p>
<p>You should be able to see one large object of ~67 objects coming from the google spreadsheet, and two arrays being displayed with two different versions of the column headers</p>
<script src="/choropleth/js/tabletop.js"></script>
<script src="/choropleth/js/miso.ds.deps.ie.min.0.4.0.js"></script>
<script type="text/javascript">
  window.onload = function() { init() };

  var mapKey = "0Arx6eO5Sf52fdDd5dFJjd3d4UEkxOHNuQnN6UnlEZkE";

  var ds = new Miso.Dataset({
    importer : Miso.Dataset.Importers.GoogleSpreadsheet,
    parser : Miso.Dataset.Parsers.GoogleSpreadsheet,
    key : mapKey,
    worksheet : "1"
  });

  function init() {
    Tabletop.init( { key: mapKey,
                     callback: showInfo,
                     simpleSheet: true,
                     postProcess: function (element) {
                      element['geojson'] = JSON.parse(element['geojson']);
                     }
                   });
  }

  function showInfo(data, tabletop) {
    console.log(data);
    console.log(tabletop.sheets('Sheet1').column_names);
    ds.fetch({ 
      success : function() {
        console.log(ds.columnNames());
      },
      error : function() {
        console.log("Are you sure you are connected to the internet?");
      }
    });
  }
</script>