Go to file
2019-06-14 15:12:21 +02:00
dist Build dist files 2019-01-21 18:00:17 +01:00
docs Add new 'Static' category to examples and remove description 2019-03-08 11:36:18 +01:00
img added example pause/play button 2013-04-02 20:50:49 -04:00
lib Use turbocarto only if there's a layer 2019-06-14 15:12:21 +02:00
template recenter 2013-04-22 11:37:12 -04:00
test Add a test for faulty scenario 2019-06-14 15:01:24 +02:00
.gitignore Moves suite-bundle.js to dist dir inside test folder 2015-12-10 12:35:25 +01:00
.travis.yml Drop support for Node.js 6 and 8 2019-03-28 15:39:54 +01:00
CONTRIBUTING.md Added contributing document 2017-01-25 10:52:04 +01:00
index.html adds loop option to gui 2014-12-15 16:04:53 +01:00
LICENSE.txt replaces Vizzuality with Cartodb 2015-07-30 16:01:57 +02:00
Makefile Fix #263 Implementation of torque layer for OpenLayers. Must be using OpenLayers 3.17 or later. 2016-07-18 12:42:01 -04:00
NEWS Stubs next version 2019-04-02 17:47:14 +02:00
package-lock.json Stubs next version 2019-04-02 17:47:14 +02:00
package.json Stubs next version 2019-04-02 17:47:14 +02:00
README.md README.md 2017-06-07 11:34:49 +02:00

Torque

Build Status

Render big, timeseries data in the client. Uses CartoDB to generate a datacube format. For a brief introduction to the format and methods, see our presentation slides

CartoDB users can use this code right away. Specify your username/tablename and datecolumn to get mapping time immediatley.

Have fun!

Torque library reference

Torque lets you render big, timeseries or categorical data in the client. This is useful for many modern applications that need more than just a static map. Early versions of Torque have been used to visualize human movement, Twitter activity, biodiversity data, and many more large-scale datasets.

The library uses CartoDB to generate a layercube format. For a brief introduction to the format and methods, see our presentation slides. If you are not using CartoDB to host your data, you can modify the input parameters to point toward any layercube service.

Getting started

The simplest way to use a visualization with Torque is...

Create a simple Torque visualization

  ...
  <body>
    <div id="map"></div>
    ...
    <script>
      // define the torque layer style using cartocss
      var CARTOCSS = [
          'Map {',
          '-torque-time-attribute: "date";',
          '-torque-aggregation-function: "count(cartodb_id)";',
          '-torque-frame-count: 760;',
          '-torque-animation-duration: 15;',
          '-torque-resolution: 2',
          '}',
          '#layer {',
          '  marker-width: 3;',
          '  marker-fill-opacity: 0.8;',
          '  marker-fill: #FEE391; ',
          '  comp-op: "lighten";',
          '  [value > 2] { marker-fill: #FEC44F; }',
          '  [value > 3] { marker-fill: #FE9929; }',
          '  [value > 4] { marker-fill: #EC7014; }',
          '  [value > 5] { marker-fill: #CC4C02; }',
          '  [value > 6] { marker-fill: #993404; }',
          '  [value > 7] { marker-fill: #662506; }',
          '  [frame-offset = 1] { marker-width: 10; marker-fill-opacity: 0.05;}',
          '  [frame-offset = 2] { marker-width: 15; marker-fill-opacity: 0.02;}',
          '}'
      ].join('\n');

        
      var map = new L.Map('map', {
        zoomControl: true,
        center: [40, 0],
        zoom: 3
      });

      L.tileLayer('http://{s}.api.cartocdn.com/base-dark/{z}/{x}/{y}.png', {
        attribution: 'CartoDB'
      }).addTo(map);

      var torqueLayer = new L.TorqueLayer({
        user       : 'viz2',
        table      : 'ow',
        cartocss: CARTOCSS
      });
      torqueLayer.addTo(map);
      torqueLayer.play()
    </script>
  </body>

Grab the complete example source code

API

see reference