The GeometryProvider 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 GeometryProvider 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 GeometryProvider(geometries); laySelected.Style.Outline = new Pen(Color.Magenta, 3f); laySelected.Style.EnableOutline = true; myMap.Layers.Add(laySelected);
List<SharpMap.Geometries.Geometry> geometries = new List<SharpMap.Geometries.Geometry>(); //Add two points geometries.Add(new SharpMap.Geometries.Point(23.345,64.325)); geometries.Add(new SharpMap.Geometries.Point(23.879,64.194)); SharpMap.Layers.VectorLayer layerVehicles = new SharpMap.Layers.VectorLayer("Vechicles"); layerVehicles.DataSource = new SharpMap.Data.Providers.GeometryProvider(geometries); layerVehicles.Style.Symbol = Bitmap.FromFile(@"C:\data\car.gif"); myMap.Layers.Add(layerVehicles);