Select to view content in your preferred language

GUID for layers in Map Services

975
3
10-17-2011 05:36 AM
SteveBratt
Regular Contributor
So in ArcMap, there's a way to uniquely identify a layer using a GUID. My problem is trying to uniquely id a layer once it's in a Map Service using the Silverlight API.

How do I get a unique handle to a layer in a Map Service?
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
You can probably create an AttachProperty on the Layer and use this to generate a new GUIDhttp://msdn.microsoft.com/en-us/library/system.guid.newguid%28v=vs.95%29.aspx.

public static readonly DependencyProperty GuidProperty =
 DependencyProperty.RegisterAttached("Guid", typeof(Guid), typeof(MainPage), null);

public static Guid GetGuid(DependencyObject layer)
{
 return (Guid)layer.GetValue(GuidProperty);
}

public static void Guid(DependencyObject layer, Guid guid)
{
 layer.SetValue(GuidProperty, guid);
}
0 Kudos
SteveBratt
Regular Contributor
If you recreate the map service, does it keep the previous layer guids?
0 Kudos
JenniferNery
Esri Regular Contributor
This is only client-side. If you want the GUID information saved on the service, I'm not sure that is supported. REST API does not expose it.
0 Kudos