Alvic, Here is a code snippet of how I create a client side time aware featurelayer. I have a asp.net REST service that queries a SQL Server instance that has the lat lon and other info for my sheriff patrol units that I display in the map: //create a feature collection for the units var featureCollection = {
"layerDefinition": null,
"featureSet": {
"features": [],
"geometryType": "esriGeometryPoint"
}
};
featureCollection.layerDefinition = {
"geometryType": "esriGeometryPoint",
"objectIdField": "ObjectID",
"drawingInfo": {
"renderer": {
"type": "simple",
"symbol": {
"type": "esriPMS",
"url": "images/i_unit2.png",
"contentType": "image/png",
"width": 70,
"height": 34
}
}
},
timeInfo: {
"startTimeField": "Date_Time",
"endTimeField": null,
"trackIdField": "UnitID",
"timeExtent": [
new Date(BDate),
new Date(EDate)
],
"timeReference": {
"timeZone": "Central Standard Time",
"respectsDaylightSaving": true
},
"timeInterval": 1,
"timeIntervalUnits": "esriTimeUnitsMinutes",
"exportOptions": {
"useTime": true,
"timeDataCumulative": false,
"timeOffset": null,
"timeOffsetUnits": null
},
"hasLiveData": true
},
"fields": [{
"name": "ObjectID",
"alias": "ObjectID",
"type": "esriFieldTypeOID"
}, {
"name": "ID",
"alias": "ID",
"type": "esriFieldTypeString"
},{
"name": "UnitID",
"alias": "Unit ID",
"type": "esriFieldTypeString"
}, {
"name": "Lat",
"alias": "Latitude",
"type": "esriFieldTypeDouble"
}, {
"name": "Lon",
"alias": "Longitude",
"type": "esriFieldTypeDouble"
}, {
"name": "Date_Time",
"alias": "Date Time",
"type": "esriFieldTypeDate"
}, {
"name": "description",
"alias": "Description",
"type": "esriFieldTypeString"
}, {
"name": "title",
"alias": "Title",
"type": "esriFieldTypeString"
}]
};
//define a popup template
var popupTemplate = new PopupTemplate({
title: "{title}",
description: "{description}"
});
var featureLayer = new FeatureLayer(featureCollection, {
id: 'unitLayer', infoTemplate: popupTemplate
});
//Set your layers renderer
//featureLayer.setRenderer(buildRenderer());
map.addLayers([featureLayer]);