void qt_ExecuteCompleted(object sender, QueryEventArgs e)
{
#region Since featureset does not include layerdefinition, we would have to populate it with appropriate drawinginfo
Dictionary<string, object> layerdef = new Dictionary<string, object>();
Dictionary<string, object> defdictionary = new Dictionary<string, object>()
{
{ "id", 0 },
{ "name", "Earthquakes from last 7 days" }
};
Dictionary<string, object> renderer = new Dictionary<string, object>();
renderer.Add("type", "simple");
renderer.Add("style", "esriSMSCircle");
int[] color = new int[] { 255, 0, 0, 255 };
renderer.Add("color", color);
renderer.Add("size", 4);
int[] outlinecolor = new int[] { 0, 0, 0, 255 };
defdictionary.Add("drawingInfo", renderer);
layerdef.Add("layerDefinition", defdictionary);
#endregion
//Add a FeatureCollection to operational layers
FeatureCollection featureCollection = null;
if (e.FeatureSet.Features.Count > 0)
{
var sublayer = new WebMapSubLayer();
sublayer.FeatureSet = e.FeatureSet;
sublayer.AddCustomProperty("layerDefinition", layerdef);
featureCollection = new FeatureCollection { SubLayers = new List<WebMapSubLayer> { sublayer } };
}
if (featureCollection != null)
operationLayers.Add(new WebMapLayer { FeatureCollection = featureCollection });
//Create a new webmap object and add base map and operational layers
webmap = new WebMap() { BaseMap = basemap, OperationalLayers = operationLayers };
Document webmapdoc = new Document();
webmapdoc.GetMapCompleted += (a, b) =>
{
if (b.Error == null)
{
b.Map.Extent = new ESRI.ArcGIS.Client.Geometry.Envelope(-20000000, 1100000, -3900000, 11000000);
LayoutRoot.Children.Add(b.Map);
}
};
webmapdoc.GetMapAsync(webmap);
}