0

I have created a web map using CARTODB API. I'm wanting to make an animation map with my points. The map points displays properly, but the time slider will not display as well as no animation of points. Here's my HTML:

<!DOCTYPE html>
<html>
  <head>
    <title>Easy example | CartoDB.js</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
    <style>
      html, body, #map {
        height: 100%;
        padding: 0;
        margin: 0;
      }
    </style>

    <link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" />
  </head>
  <body>
    <div id="map"></div>

    <script src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script>

    <script>

function main() {
        cartodb.createVis('map', 'http://mmckeever92.carto.com/api/v2/viz/042d1afc-7df7-40a7-8765-bebcd4b0e855/viz.json', {
            shareable: true,
            title: true,
            description: true,
            search: true,
            tiles_loader: true,
            center_lat: 43.728,
            center_lon: -79.379,
            zoom: 11
        })
        .done(function(vis, layers) {
      var slider = vis.getOverlay('time_slider')
      slider.formatter(function(d) {
        return  d.getUTCMonth()+"-"+ d.getUTCDay() + " "+ d.getUTCHours() + ":"+ d.getUTCMinutes();
      })
    })
    .error(function(err) {
      console.log(err);
    });
  }

      window.onload = main;
</script>
  </body>
</html>

I have a feeling that I am having the same issue as they did here: Torque map slider formatting problem

Does anyone have a clue as to why my time slider won't display in my map?

1

BUILDER vizjsons are not fully compatible with CARTO.js or Torque.js, you will need to use createLayer as in this working example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.