AnsweredAssumed Answered

featureLayer timeExtent doesn't match timeExtent from service description???

Question asked by derekwaynemiller on Jan 18, 2013
Latest reply on Jan 23, 2013 by derekwaynemiller
Hello All,

I'm putting together a map that incorporates two time enabled featurelayers with a timeSlider. Problem is, the timeExtent of the featurelayer is 1 year less than it should be, i.e. the layer.timeInfo.timeExtent.endTime of the featureLayer is returning a value of 2011, when in reality it is 2012 (the map service description confirms the timeExtent end time to be 2012).

So, the url to the MapServer to confirm the timeExtent of the service: http://cgisagsec2.portlandoregon.gov/arcgis/rest/services/BPS/solar_pdx/MapServer/0

And the code:

featurelayers are defined and pushed into an empty Array. The layers array is added to the map firing the timeSlider function (keep in mind these are snippets):

var timeLayers = []; dojo.connect(map, "onLayersAddResult", initSlider); timeLayers.push(resSolar); timeLayers.push(comSolar); map.addLayers(timeLayers);
//function to initialize the time slider     function initSlider (results) {       var timeLayers = dojo.map(results, function (result) {         return result.layer;       });       var timeExtent = new esri.TimeExtent();       timeExtent.startTime = new Date("1/1/2001 UTC");       timeExtent.endTime = new Date("1/31/2012 UTC");       map.setTimeExtent(timeExtent);       var timeSlider = new esri.dijit.TimeSlider({}, dojo.byId("timeSlider"));       map.setTimeSlider(timeSlider);       timeSlider.setThumbCount(1);       timeSlider.createTimeStopsByCount(timeExtent, 12);       timeSlider.setThumbMovingRate(1000);       timeSlider.setLoop(false);       timeSlider.startup();                //add ticks just at beginning and end       var labels = ['2001','2012'];       timeSlider.setLabels(labels);       dojo.connect(timeSlider, "onTimeExtentChange", function() {         var end = results[0].layer.timeInfo.timeExtent.endTime;         console.log(end);       });     }


The slider functions properly with the exception of the final 'tick'. The final tick sets the map.timeExtent to 1/1/2001 - 1/31/2012. The data ends at 1/1/2012, but yet none of the 2012 records display????

You may view the map and console logs at this url: http://www.portlandbps.com/gis/solar/index3.html

I'm at a loss, and I appreciate any help.

Cheers.

- d

Outcomes