protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InMemoryFeatureLayer inmemoryFeatureLayer = new InMemoryFeatureLayer(); inmemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap; inmemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1; inmemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; Random ra = new Random(); for (int i = 0; i < 20000; i++) { int x = ra.Next(0, 1800); int y = ra.Next(0, 900); double dx = x / 10; double dy = y / 10; PointShape point = new PointShape(dx, dy); Feature fe = new Feature(dx, dy); inmemoryFeatureLayer.InternalFeatures.Add(fe); } inmemoryFeatureLayer.BuildIndex(); LayerOverlay overLay = new LayerOverlay(); overLay.Layers.Add("inmemoryFeatureLayer",inmemoryFeatureLayer); inmemoryFeatureLayer.Open(); Map1.CurrentExtent = inmemoryFeatureLayer.GetBoundingBox(); inmemoryFeatureLayer.Close(); Map1.MapUnit = GeographyUnit.DecimalDegree; Map1.CustomOverlays.Add(overLay); } } protected void Map1_Click1(object sender, MapClickedEventArgs e) { InMemoryFeatureLayer inmLayer = (Map1.CustomOverlays[0] as LayerOverlay).Layers["inmemoryFeatureLayer"] as InMemoryFeatureLayer; inmLayer.Open(); Feature clickedFeature = inmLayer.FeatureSource.GetFeaturesNearestTo(new PointShape(e.Position.X, e.Position.Y), GeographyUnit.DecimalDegree, 1, ReturningColumnsType.NoColumns)[0]; }