void trackOverlay_TrackEnded (object sender, TrackEndedTrackInteractiveOverlayEventArgs e) { InMemoryFeatureLayer memLayer = new InMemoryFeatureLayer(); if (wpfMap1.TrackOverlay.TrackMode == TrackMode.Polygon) { PolygonShape polygonShape = (PolygonShape)e.TrackShape; memLayer.InternalFeatures.Add(new Feature(polygonShape)); MessageBox.Show("The polygone is saved in memory!"); } else MessageBox.Show("The line zone is not saved!"); LayerOverlay inmemoryOverlay = new LayerOverlay(); inmemoryOverlay.Layers.Add("PolyLayer", memLayer); wpfMap1.Overlays.Add("PolyLayer", inmemoryOverlay); } private void btnSaveZones_Click(object sender, RoutedEventArgs e) polygfts = polygLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns); if (wpfMap1.TrackOverlay.TrackMode == TrackMode.Polygon) FeatureLayer polyArea = wpfMap1.FindFeatureLayer( "PolyLayer"); if (polyArea != null ) { CovertPolygonLayerToZones(zoneDef, polyArea); MessageBox.Show("Polygon Processing Done." ); } else MessageBox.Show("Polygon Processing cannot be Done." ); } private void CovertPolygonLayerToZones(PolygonZone zoneDef, FeatureLayer polygLayer) { polygLayer.FeatureSource.Open(); Collection polygfts = polygLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns); for (int i = 0; i < polygfts.Count; i++) MultipolygonShape mpolyg = (MultipolygonShape)polygfts.GetShape();// type conversion problem: PolygonShape -> MultipolygonShape not allowed }