AnsweredAssumed Answered

Temporal Renderer w TimeClassBreaksAger in Real-Time

Question asked by carisasmith on Jul 16, 2015
Latest reply on Jul 21, 2015 by carisasmith

I'm struggling to get the Temporal Renderer to work with real-time data.  The renderer seems to work w my UniqueValueRenderer as the ObservationRenderer of the Temporal Renderer, but the Ager doesn't seem to work.  I have been able to get the Temporal Renderer w the Ager working with historic data and a time slider, but w the real-time data it is not working.  I must have some setting incorrect or something somewhere.  I've tried to look on-line but haven't found much and a lot of the ESRI examples for real-time data are not working or there are no hurricanes or earthquakes occurring at this time.  I'm using a Feature Collection Object to create my Feature Layer and I'm NOT using a TimeSlider, since this is real-time data.  I believe or have read that if the start and endTime extent are set to the same time, then it should be set for a time instant which I have since data is added in real-time.  Let me know if you see anything that I don't have set-up correctly.  I have looked at the time formats as well for gps_time and all seems to be correct in this format: Thu Jul 16 2015 11:38:54 GMT-0600 (MDT)

 

Thanks!  - Carisa

 

Some of the renderer code.. trying to keep it as simple as possible just to get this working for now:

var simplerMarker = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,12,new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,

        new Color("red"), 1),

        new Color("red"));

        var observationRend = new UniqueValueRenderer(simplerMarker,"group");

 

        observationRend.addValue("SolidWaste",new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,10,new SimpleLineSymbol(SimpleLineSymbol.STYLE_NULL),new Color([255, 153, 0])));

        observationRend.addValue("StormSweeper",new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,10,new SimpleLineSymbol(SimpleLineSymbol.STYLE_NULL),new Color([9, 112, 84])));

 

        var infos = [

        { minAge: 0, maxAge: 15, size: 15},

        { minAge: 15, maxAge: 24, size: 11},

        { minAge: 24, maxAge: Infinity, size: 6}

        ];

 

        var observationAger = new TimeClassBreaksAger(infos, TimeClassBreaksAger.UNIT_SECONDS);

        rendererBC = new TemporalRenderer(observationRend,null,null,observationAger);

 

Then I'll set the map's time extent since I'm not using a Time Slider:

          var timeExtent = new TimeExtent();

          var now = new Date();

          timeExtent.startTime = now;

          timeExtent.endTime = now;

          map.setTimeExtent(timeExtent);

 

Feature Collection object set-up for the Feature Layer:

                //Create Feature Layer for Vehicles

                var featureCollection = {

                  "layerDefinition": null,

                  "featureSet": {

                    "features": [],

                    "geometryType": "esriGeometryPoint"

                  }

                };

 

                        featureCollection.layerDefinition = {

                          "geometryType": "esriGeometryPoint",

                          "objectIdField": "OBJECTID",

                          "timeInfo": {

                            "startTimeField": "gps_date",

                            "endTimeField": null,

                            "trackIdField": "unit_id",

                            "timeReference": "Mountain Standard Time",  //do I need to set this?

                            "timeInterval": 15,

                            "timeExtent": ["2015/07/16 00:00:00 UTC", "2015/07/16 00:00:00 UTC"],

                            "timeIntervalUnits": "esriTimeUnitsSeconds",

                            "exportOptions": {

                             "useTime": true,

                             "timeDataCumulative": true,

                             "timeOffset": null,

                             "timeOffsetUnits": null

                            },

                           },

                          "fields": [{

                            "name": "OBJECTID",

                            "alias": "OBJECTID",

                            "type": "esriFieldTypeOID"

                          }, {

                            "name": "unit_id",

                            "alias": "unit_id",

                            "type": "esriFieldTypeString"

                          }, {

                            "name": "gps_date",

                            "alias": "gps_date",

                            "type": "esriFieldTypeDate"

                          }, {....etc.

 

 

                    breadcrumbLayer = new FeatureLayer(featureCollection, {

                          id: 'breadcrumb',

                          mode: FeatureLayer.MODE_SNAPSHOT,

                          trackIdField: "unit_id",

                          outFields: ["*"]

                        });

 

                      //render a particular time extent - do I need this??

                      var timeExtent = new TimeExtent();

                      timeExtent.startTime = new Date("07/16/2015 UTC");

                      timeExtent.endTime = new Date("07/16/2015 UTC");

                      breadcrumbLayer.setTimeDefinition(timeExtent);

Outcomes