// Create dynamic map service webmap layer with popup private WebMapLayer CreateStateLayerWithPopup() { IList <FieldInfo> fieldinfos = new List <FieldInfo>(); fieldinfos.Add(new FieldInfo() { FieldName = "STATE_NAME", Label = "State", IsVisible = true }); IList <MediaInfo> mediainfos = new List <MediaInfo>(); MediaInfoValue infovalue = new MediaInfoValue(); infovalue.Fields = new string[] { "POP2000,POP2007" }; mediainfos.Add(new MediaInfo() { Type = MediaType.PieChart, Value = infovalue }); PopupInfo popup = new PopupInfo() { FieldInfos = fieldinfos, MediaInfos = mediainfos, Title = "Population Change between 2000 and 2007" }; return(new WebMapLayer { Url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3", LayerType = WebMapLayerType.ArcGISFeatureLayer, PopupInfo = popup }); }
public CreateWebMapObject() { InitializeComponent(); //Define BaseMap Layer basemap = new BaseMap() { Layers = new List<WebMapLayer> { new WebMapLayer { Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" } } }; //Add a ArcGISDynamicMapService operationLayers.Add(new WebMapLayer { Url = "http://serverapps10.esri.com/ArcGIS/rest/services/California/MapServer", VisibleLayers = new List<object> { 0, 1, 3, 6, 9 } }); //Define popup IList<FieldInfo> fieldinfos = new List<FieldInfo>(); fieldinfos.Add(new FieldInfo() { FieldName = "STATE_NAME", Label = "State", Visible = true }); IList<MediaInfo> mediainfos = new List<MediaInfo>(); MediaInfoValue infovalue = new MediaInfoValue(); infovalue.Fields = new string[] { "POP2000,POP2007" }; mediainfos.Add(new MediaInfo() { Type = MediaType.PieChart, Value = infovalue }); PopupInfo popup = new PopupInfo() { FieldInfos = fieldinfos, MediaInfos = mediainfos, Title = "Population Change between 2000 and 2007", }; //Add a Feature Layer with popup operationLayers.Add(new WebMapLayer { Url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3", Mode = FeatureLayer.QueryMode.OnDemand, PopupInfo = popup }); //Perform Query to get a featureSet and add to webmap as featurecollection QueryTask qt = new QueryTask() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0" }; qt.ExecuteCompleted += qt_ExecuteCompleted; ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query(); query.OutFields.Add("*"); query.Where = "magnitude > 3.5"; query.ReturnGeometry = true; qt.Failed += (a, b) => { MessageBox.Show("QueryTask failed to execute:" + b.Error); }; qt.ExecuteAsync(query); }
// Create dynamic map service webmap layer with popup private WebMapLayer CreateStateLayerWithPopup() { IList<FieldInfo> fieldinfos = new List<FieldInfo>(); fieldinfos.Add(new FieldInfo() { FieldName = "STATE_NAME", Label = "State", IsVisible = true }); IList<MediaInfo> mediainfos = new List<MediaInfo>(); MediaInfoValue infovalue = new MediaInfoValue(); infovalue.Fields = new string[] { "POP2000,POP2007" }; mediainfos.Add(new MediaInfo() { Type = MediaType.PieChart, Value = infovalue }); PopupInfo popup = new PopupInfo() { FieldInfos = fieldinfos, MediaInfos = mediainfos, Title = "Population Change between 2000 and 2007", }; return new WebMapLayer { Url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3", PopupInfo = popup }; }
public CreateWebMapObject() { InitializeComponent(); //Define BaseMap Layer basemap = new BaseMap() { Layers = new List <WebMapLayer> { new WebMapLayer { Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" } } }; //Add a ArcGISDynamicMapService operationLayers.Add(new WebMapLayer { Url = "http://serverapps10.esri.com/ArcGIS/rest/services/California/MapServer", VisibleLayers = new List <object> { 0, 1, 3, 6, 9 } }); //Define popup IList <FieldInfo> fieldinfos = new List <FieldInfo>(); fieldinfos.Add(new FieldInfo() { FieldName = "STATE_NAME", Label = "State", Visible = true }); IList <MediaInfo> mediainfos = new List <MediaInfo>(); MediaInfoValue infovalue = new MediaInfoValue(); infovalue.Fields = new string[] { "POP2000,POP2007" }; mediainfos.Add(new MediaInfo() { Type = MediaType.PieChart, Value = infovalue }); PopupInfo popup = new PopupInfo() { FieldInfos = fieldinfos, MediaInfos = mediainfos, Title = "Population Change between 2000 and 2007", }; //Add a Feature Layer with popup operationLayers.Add(new WebMapLayer { Url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3", Mode = FeatureLayer.QueryMode.OnDemand, PopupInfo = popup, }); //Perform Query to get a featureSet and add to webmap as featurecollection QueryTask qt = new QueryTask() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0" }; qt.ExecuteCompleted += qt_ExecuteCompleted; ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query(); query.OutFields.Add("*"); query.Where = "magnitude > 3.5"; query.ReturnGeometry = true; qt.Failed += (a, b) => { MessageBox.Show("QueryTask failed to execute:" + b.Error); }; qt.ExecuteAsync(query); }