The MemoryProvider doesn’t utilize performance optimizations of spatial indexing, and thus is primarily meant for rendering a limited set of Geometries.
A common use of the MemoryProvider is for highlighting a set of selected features.
List<Geometry> geometries = myMap.Layers[0].DataSource.GetGeometriesInView(myBox); VectorLayer laySelected = new VectorLayer("Selected Features"); laySelected.DataSource = new MemoryProvider(geometries); laySelected.Style.Outline = new Pen(Color.Magenta, 3f); laySelected.Style.EnableOutline = true; myMap.Layers.Add(laySelected);
List<Mapsui.Geometries.Geometry> geometries = new List<Mapsui.Geometries.Geometry>(); //Add two points geometries.Add(new Mapsui.Geometries.Point(23.345,64.325)); geometries.Add(new Mapsui.Geometries.Point(23.879,64.194)); Mapsui.Layers.VectorLayer layerVehicles = new Mapsui.Layers.VectorLayer("Vechicles"); layerVehicles.DataSource = new Mapsui.Data.Providers.MemoryProvider(geometries); layerVehicles.Style.Symbol = Bitmap.FromFile(@"C:\data\car.gif"); myMap.Layers.Add(layerVehicles);