AnsweredAssumed Answered

Can you use time-extent and layer definitions together to filter map services?

Question asked by Libetti on Nov 4, 2019

Greetings,

 

I have several time-enabled map services that are displayed in the form of ArcGISDynamicMapServiceLayers. I want to allow the user to explicitly set the time-extent of the individual layers as they are added - i.e  Monday at hour 23:00 - to filter out any gratuitous values. My data sets come with "dayofweek" and "hour" attributes that are correlated to the specified layers' time-extent.

let timeExtent = new TimeExtent(
            new Date(
              `2017-09-${dojo.byId("staticDay").value}T${dojo
                .byId("staticHour")
                .value.padStart(2"0")}:00:00`
            ),
            new Date(
              `2017-09-${dojo.byId("staticDay").value}T${dojo
                .byId("staticHour")
                .value.padStart(2"0")}:00:00`
            )
          );
this.map.setTimeExtent(timeExtent);

When I set the time extent explicitly to one value like previewed above, I notice through the Attribute Table widget that the results being displayed have "dayofweek" and "hour" values ranging the entire time extent of the map service and not the one I set. As a workaround I introduced layer definitions to set the "dayofweek" and "hour" values so that they match the time-extent. No results are being displayed, notwithstanding the 10,000 results that satisfy both the service's specific day of week and hour attributes and the user set time-extent, all of which are the same value. I am considering removing time-enabledness altogether from these services and resorting only to layer definitions, as it would provide the same functionality short of time-sliders and the like of which I don't need. Could anyone offer some advice on proceeding forward with using both time-extents and layer definitions? Or perhaps a way in which I can get the desired results from my service by setting the time-extent alone? 

 

**I've also realized that you edit the map's time extent and not limit that of the service

 

I appreciate any help,

Anthony

Outcomes