Multiple tracks temporal renderer

2310
1
04-19-2016 02:05 AM
PeterDavis3
New Contributor II


Based on this sample:

https://developers.arcgis.com/javascript/jssamples/mobile_geolocaterenderer.html

I am not able to render multiple tracks in the same feature layer using the temporal renderer.

From the documentation, I was assuming that if there was multiple features in the feature table, then the track renderer would render the track based on the trackID of the feature.

TemporalRenderer | API Reference | ArcGIS API for JavaScript

"Renderer for the tracks. A track is a collection of events that share a common track ID. A track line is a graphic line that connects the observations. Applicable only for feature layers with a valid trackIdField."

Now the sample has a different trackID for each location that is added to the layer, so this doesn't seem to match what the documentation says about the trackRenderer arg of the constructor.

The only main change I am making is specifying the trackId as an argument that is paired with the position:

attributes.TrackID = trackId;

Is there something that I am missing?

0 Kudos
1 Reply
PeterDavis3
New Contributor II

I think I have found a bug in the FeatureLayer code.

after creating the feature layer

      var featureCollection = {
        layerDefinition
: layerDefinition,
        featureSet
: null
     
};
      featureLayer
= new FeatureLayer(featureCollection);

it was found that there was an internal field called _trackIdField that was undefined, yet the _startTimeField field was set to the value from the layerDefinition of "DATETIME".

So as a hack I did this after creating the feature layer:

    featureLayer._trackIdField = 'TrackID';

And I now have 10 distinct tracks with there current position, temporal observations, and track lines showing for each of the track numbers.

0 Kudos