How to change the default map layers

After defining the GIS Interface Manager, you can select the map layers which will appear on the background map and inside the map frames.
You can choose from a list of predefined layers or add your own published map services. The order in which these layers are added to the list is the order in which they will be created and added to the map. The last layer added will be the top layer.

GisInterfaceMgr bgm = GisInterfaceMgr.Instance;

List<MapLayerDef> defaultMapLayers = new List<MapLayerDef>();

// Choose any of these layers or add them all.
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.SatelliteImagery));
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.ShadedRelief);
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.StreetMap);

bgm.setDefaultMapLayerTypes(defaultMapLayers);


If you use one or more OnlinePublishedMap layers, then you have to provide the IDs/Names and URLs of these services as follows:

GisInterfaceMgr bgm = GisInterfaceMgr.Instance;

List<MapLayerDef> defaultMapLayers = new List<MapLayerDef>();
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.OnlinePublishedMap, "NewPublishedLayer", 
              "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer"));
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.SatelliteImagery));

bgm.setDefaultMapLayerTypes(defaultMapLayers);



To be able to add annotations to the map inside map frames, you can add a number of different annotation layers. If no annotation layers are added in the default list, the annotation toolbar of the map frame will be disabled and hidden. You can also add an offline annotation layer which will allow you to add annotations to the map but will not be saved when the application is closed.

GisInterfaceMgr bgm = GisInterfaceMgr.Instance;

List<MapLayerDef> defaultMapLayers = new List<MapLayerDef>();
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.SatelliteImagery));
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.OnlinePointAnnotationsLayer,     
                    "http://asebeast.cpsc.ucalgary.ca:1892/ArcGIS/rest/services/eGridAnnotations/FeatureServer/0"));
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.OnlineLineAnnotationsLayer, 
                    "http://asebeast.cpsc.ucalgary.ca:1892/ArcGIS/rest/services/eGridAnnotations/FeatureServer/1"));
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.OnlinePolygonAnnotationsLayer, 
                    "http://asebeast.cpsc.ucalgary.ca:1892/ArcGIS/rest/services/eGridAnnotations/FeatureServer/2"));

bgm.setDefaultMapLayerTypes(defaultMapLayers);


You can also add an offline annotation layer which will allow you to add annotations to the map but will not be saved when the application is closed.

GisInterfaceMgr bgm = GisInterfaceMgr.Instance;

List<MapLayerDef> defaultMapLayers = new List<MapLayerDef>();
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.SatelliteImagery));
defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.OfflineAnnotationLayer));

bgm.setDefaultMapLayerTypes(defaultMapLayers);

Last edited Jul 11, 2011 at 10:12 PM by ealafselim, version 4

Comments

No comments yet.