ArcGIS Online Traffic data and TimeSlider conflict

1302
2
Jump to solution
01-04-2017 04:22 AM
MarkSmith
New Contributor III

Hello,

I have a JavaScript application already using one of my own time-aware map services with a timeslider controlling the display of the features.  I now want to add the option to display the LIVE traffic data from ArcGIS Online (unaffected by the timeslider).  I know how to display the traffic data normally, that's fine.

The problem is I don't want the traffic data to be affected by the timeslider (because it is live data), I only want the timeslider to control the features in my own map service.  But because the timeslider is added to the 'map', and not a specific DynamicMapServiceLayer, it wants to control both my DynamicMapServiceLayer and the traffic data DynamicMapServiceLayer, the result being the traffic data disappears from the map.

When my code applies the timeslider to the map with:

map.setTimeSlider(timeSlider);

timeSlider.startup();

The traffic data disappears because both services are added to the 'map'.  I need to be able to display historic data from my service controlled by the timeslider AND the live traffic data unaffected by the timeslider.  Alternatively a way to toggle between the two.

Can anyone please tell me how I can make this work?  How can I essentially break the relationship between the traffic service from the timeslider so I can show the live traffic data at the same time as having a timeslider applied to the map?

Alternatively, how can destroy the timeslider to allow me to at least toggle between viewing the traffic data and the time-aware data in my other service?

Thank you,

Mark.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Mark,

   An ArcGISDynamicMapServiceLayer has a setUseMapTime method that you will use to set it to false.

ArcGISDynamicMapServiceLayer | API Reference | ArcGIS API for JavaScript 3.19 | setUseMapTime 

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Mark,

   An ArcGISDynamicMapServiceLayer has a setUseMapTime method that you will use to set it to false.

ArcGISDynamicMapServiceLayer | API Reference | ArcGIS API for JavaScript 3.19 | setUseMapTime 

0 Kudos
MarkSmith
New Contributor III

Fantastic, thank you.

0 Kudos