Manually Plotting Lat/Long Points on a Map over time using the TimeSlider

886
2
08-05-2013 04:35 PM
AlvicPaje
New Contributor
I am having a hard time figuring out how to do this without using ArcMap to plot my data first. 

What I need to do is be able to plot points on a map over time, say like a driving route, and use the TimeSlider to play back that route.  All I have access to is a base map (e.g. https://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer) and cannot make use of a service to get any time aware data to plot.

My constraints are that I cannot use an external service for the data, I need to do it manually on demand.  I have a base map and can successfully draw points on the map using the lat long.  I have even created a feature layer to add a working TimeSlider.

My problem is my points (graphics) are not Time Aware and I have no clue how to make them that way.  The examples I've seen have data that comes from somewhere hosted on this site.  Maybe I am completely misunderstanding how TimeSlider and time aware data works with ArcGis. 

Is what I am trying to do possible?

Any help would be much appreciated.
0 Kudos
2 Replies
TyroneLigon
Occasional Contributor
If you didn't get this question answered, I just implemented this about a week ago. Take a look at this post. I can't post my code but I probably can answer your questions.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
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]);
0 Kudos