Update time extent without restarting Map Service?

5774
11
Jump to solution
03-27-2012 11:41 AM
JasonGreenlaw
Occasional Contributor
Does anyone know if it is possible to update the time extent of a map service without restarting it?

I have a map service with a single layer whose source is a Mosaic Dataset.  The MD is stored in an enterprise geodatabase (SDE) and I have modified the attribute table to have start & end time fields, and the map service was published with time enabled.  I also checked the box that says something like "Data changes frequently so calculate time extent automatically".

My data does change pretty frequently (several times per day), so I am constantly adding and removing rasters from the MD and updating their time fields accordingly.  However, the map service's time extent (as reported on the REST service description page and via WMS GetCapabilities) is not updated until I perform a service restart.

Restarting the service each time the data changes is not an option for me since it will change so frequently.  I tried looking around the Administrator Directory but couldn't find anything related to updating/refreshing the time extent.

I am using ArcGIS Server 10.1 Prerelease on Linux (64-bit RHEL6).

Any information would be appreciated.
Jason
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
SrinivasVinnakota
Esri Contributor
To get updated info on a map:
http://<hostname>:6080/arcgis/rest/services/<folder>/<service>/MapServer?returnUpdates=true&f=json
Map response would be:
{"timeExtent":[<startTime>, <endTime>]}


To get updated info on a layer:
http://<hostname>:6080/arcgis/rest/services/<folder>/<service>/MapServer/<layerId>?returnUpdates=true&f=json
Layer response would be:
{"id":<layerId>, "timeExtent":[<startTime>, <endTime>]}


returnUpdates would not update REST service description pages as the information on these pages is cached whenever a service starts.

View solution in original post

0 Kudos
11 Replies
SrinivasVinnakota
Esri Contributor
Jason,
At ArcGIS for Server 10.1 Final release, time enabled map services would support a new parameter called returnUpdates, which would return updated timeExtents for the time-aware layer/mapService.
0 Kudos
JasonGreenlaw
Occasional Contributor
Srinivas,

Thanks for your response.  That is encouraging.  Do you know if sending a returnUpdates request to the Map Service will result in the WMS GetCapabilities file and the REST service description page to be updated as well?  Or is there another method for updating these fields?

Can you give me an example of a returnUpdates request? 

I am guessing it would look something like this:

http://<hostname>:6080/arcgis/rest/services/<folder>/<service>/MapServer/returnUpdates

Thanks,
Jason
0 Kudos
SrinivasVinnakota
Esri Contributor
To get updated info on a map:
http://<hostname>:6080/arcgis/rest/services/<folder>/<service>/MapServer?returnUpdates=true&f=json
Map response would be:
{"timeExtent":[<startTime>, <endTime>]}


To get updated info on a layer:
http://<hostname>:6080/arcgis/rest/services/<folder>/<service>/MapServer/<layerId>?returnUpdates=true&f=json
Layer response would be:
{"id":<layerId>, "timeExtent":[<startTime>, <endTime>]}


returnUpdates would not update REST service description pages as the information on these pages is cached whenever a service starts.
0 Kudos
JasonGreenlaw
Occasional Contributor
Thanks for the info.  Do you know if you would also be able to get an updated WMS Capabilities XML by using the following URL structure?:


http://<hostname>:6080/arcgis/rest/services/<folder>/<service>/MapServer/WMSServer?returnUpdates=true&request=GetCapabilities&service=WMS
0 Kudos
SrinivasVinnakota
Esri Contributor
WMSServer does not support "returnUpdates" parameter.
0 Kudos
PonLertsakdadet
New Contributor
I'm facing the same problem. My application has a TimeSlider and an Editor. The problem is I can't get an updated time extent after I add a new feature with a date that is beyond the initial max time extent.
For example, my TimeSlider widget starts in 2005 and ends at 2011, which is min and max time. When I add a new feature in 2012, I simply can't update the TimeSlider widget because the layer's time extent remains the same.
As far as I know, I have to restart the service and clear the REST cache.

So, there is no way to do this in ArcGIS Server 10. Am I correct? Please confirm.
0 Kudos
JasonGreenlaw
Occasional Contributor
Chalermpon,

Although I still have to do more testing, I believe that you CAN update the time slider and request data at an updated time extent from a service. 

Assuming you're using the Javascript API, your layer object's timeExtent property will still represent the old time extent, since (as far as I know) there is no way to refresh this in memory.  However, you should be able to manually perform a JSON query (using esri.request() or dojo.io.script.get()) to your map service's MapServer URL using the format described above by Srinivas, e.g.
http://<server address>/arcgis/rest/services/<servicename>/MapServer?returnUpdates=true&f=json
, and then use the result to update your Time Slider. 

As long as you don't rely on your layer object's timeExtent, and instead request this information directly from ArcGIS Server using returnUpdates, it *should* work.  Please test and let me know if this is not the case, I'm interested to know.

It would be great if someone from ESRI could confirm this behavior.

Jason
0 Kudos
CarmellaBurdi1
New Contributor III

Hi Jason,

I'm sorry to be responding to this so many years later - but I'm in a pickle and your answer seems to be the only thing close to an answer I can find.

I am using Portal 10.4 and cannot upgrade at this time. 

  • I have a web application that has a basemap with a time aware layer in it. 
  • I have a GP service that performs some calculations - one of which is updating my time fields that inform the time slider. 
  • I have a time slider that I want to then use to show the updated time data that my GP service just calculated.
  • However, the time aware data layer that's in my map/app does not update when the GP service is run... making it pretty useless as you'd have to then open up the map you created, turn off disable time, re-enable time, etc....

I'm looking for a way to make sure that the map updates itself when you run the GP service.

Any help would be appreciated! I'm going to put this in it's own thread as well.


Thanks!


Carmie

0 Kudos
PaulDodd
New Contributor II

Hello,

Time aware services will report their time extents using the ‘returnUpdates’ endpoint, but you need to make sure the service includes the ‘hasLiveData’ property somewhere.

 

For a Map Service, make sure the Time dialog on the Layer Properties for at least one Layer has the ‘data changes frequently so calculate time extent automatically’ check box is checked on. This sets the Layer ‘hasLiveData’ to true and will refresh the properties periodically.

 

For other Services, you’ll want to leverage the ‘Refresh Service’ GP tool and set the service JSON properties to include the key value pair of "hasLiveData": "true". See: https://developers.arcgis.com/rest/services-reference/refreshservice.htm

 

In most cases, the REST cache CAN be cleared to propagate the updated time details to the service following a data change by invoking the ‘Clear Rest Cache’ admin function. Simply specify the service folder, name, and type to flush the cache and force the service to update the properties: https://developers.arcgis.com/rest/enterprise-administration/server/handlersrestcacheclear.htm

I hope this helps, Paul

0 Kudos