How to force a refresh of a single map service layer?

2912
5
08-09-2011 04:42 AM
RickThiel
Occasional Contributor
Hello,

I am somewhat new to the ArcGIS Silverlight API and I need some help getting over a hurdle.  I basically need to know the syntax for getting a handle to a single map service layer in my map and then forcing it to refresh itself.  I have been looking at the api for a day and I have not found anything that is working for me.

Thank you so much.  --Rick
0 Kudos
5 Replies
DorothyMortenson
Occasional Contributor II
I'm no expert either, but I'll add what I know that might help you move on to the next step.

I'm not sure you can actually stop and start services in the API, particularly a specific layer within the API. I think it's an ArcGIS Server thing.

I have a set of data that gets updated every morning. Because they are part of a map service, I cannot just replace the data, as it will say it's locked or being used. So I have to stop and start the service, but it's the entire service.  I do this in a batch job that runs on a schedule.  The commands are:

C:\gisdata\tools\BatchServiceTool\arcgisservice <name of server> Framework/OWRD_Large_Dams MapServer stop
C:\gisdata\tools\BatchServiceTool\arcgisservice <name of server> Framework/OWRD_Large_Dams MapServer start

From your API, I would think you could go run this job, as you would a python script or some other script. But I don't know if you would run into problems since the service is open in your application.

Good luck.
Dorothy
0 Kudos
RickThiel
Occasional Contributor
Thanks Dorothy, I appreciate that you took the time to reply to me.

However, I think that I might have caused confusion with my post...  I do not need to stop and start a service.  I just need my map viewer to go to the web-service and grab a fresh set of data when an event happens (ie. a button click).

Does anyone else have any ideas?

Thanks, --Rick
0 Kudos
IgressT
New Contributor II
Thanks Dorothy, I appreciate that you took the time to reply to me.

However, I think that I might have caused confusion with my post...  I do not need to stop and start a service.  I just need my map viewer to go to the web-service and grab a fresh set of data when an event happens (ie. a button click).

Does anyone else have any ideas?

Thanks, --Rick


Each layer has a Refresh().... I guess that's not working for you
0 Kudos
RickThiel
Occasional Contributor
Thanks doc21.  I guess that is my question.  I do not know how to get a handle to each layer programmatically and then call the refresh for each layer.  Do you have some example code?  thanks, --Rick
0 Kudos
TerryGiles
Occasional Contributor III
Rick,

What kind of layer is it?  If it's a ArcGISDynamicMapServiceLayer also try setting the DisableClientCaching property to true, then call refresh.  Worked for me to refresh an event layer after the user updates lat-longs in a SQL Server table as described here - http://forums.arcgis.com/threads/31439-Refreshing-map-or-layer-display
0 Kudos