how to refresh map service from legend

1017
5
10-29-2013 12:17 PM
Labels (1)
FrancoisGilbert
New Contributor
Hello,

I have built a WPF client application that is using the esri:legend toolbox. The map that I am adding in the legend are comming from map packages files. Sometimes my map packages files are getting updated. Then I would like to update only the local map service instead of closing and opening the application. Do you have a code sample in vb.net that does that.

François
0 Kudos
5 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Please can you provide more details regarding exactly how the map packages are being updated whilst the application is running?

Cheers

Mike
0 Kudos
FrancoisGilbert
New Contributor
Good Morning,

The team here is looking at the latest weather forecats with our WPF application. There is a python script that is running in the background and whenever a new forecast is avalable, the script reads it and produce a new map package. I would like my application to be able to update that new map package instead of closing and reopening the application. I suppose I need to stop and restart the local map service.

François
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Without knowing more detail on how you're updating the layers - What you should probably do is programmatically create a new local map service based on the new map package, start the service and create a new local dynamic layer then remove the existing local dynamic map service layer from the map, stop the existing local map service, and add the new layer to the map (either with the same layer ID as the previous layer or if it's a new ID you may need to update the legend map layers. You might like to try applying some transparency to the layers as you're removing one and adding the other in order that the transition appears smoother?

Cheers

Mike
0 Kudos
FrancoisGilbert
New Contributor
Thanks Mike,

I thought the work flow would have been more automated like I would call a update method on the local map service but the method you are talking about is feasible. Is this the same method when the map is stored on the server instead of local map package.

François
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

For a server-based scenario it's probably the same workflow unless perhaps you're using image services.

Cheers

Mike
0 Kudos